From 77eb21b646640320022669abd5c3fac002cad1ee Mon Sep 17 00:00:00 2001
From: Phil <phil@secdev.org>
Date: Fri, 19 Dec 2008 17:04:45 +0100
Subject: [PATCH] Avoid using the same byte for corruption in corrupt_bytes()
 (ticket #155)

---
 scapy/utils.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scapy/utils.py b/scapy/utils.py
index 6c10cc13..11cff5fd 100644
--- a/scapy/utils.py
+++ b/scapy/utils.py
@@ -410,7 +410,7 @@ def corrupt_bytes(s, p=0.01, n=None):
     if n is None:
         n = max(1,int(l*p))
     for i in random.sample(xrange(l), n):
-        s[i] = random.randint(0,255)
+        s[i] = (s[i]+random.randint(1,255))%256
     return s.tostring()
 
 @conf.commands.register
-- 
GitLab