Ticket #6 (closed defect: fixed)
wrong index in X3BytesField.addfield()
| Reported by: | nbareil@… | Owned by: | pbi |
|---|---|---|---|
| Priority: | minor | Milestone: | scapy 2.2 |
| Component: | Scapy | Version: | 1.0.4 |
| Keywords: | Cc: |
Description
SNAP was behaving strangely :
>>> linehexdump(SNAP(OUI=0xcc)) 00 00 00 00 00 ..... >>> linehexdump(SNAP(OUI=0x00cc00)) 00 00 CC 00 00 ..... >>> linehexdump(SNAP(OUI=0xaabbcc)) 00 AA BB 00 00 .....
There was a bad index in 3BytesField in addfield(), this patch fixes it.
--- scapy.py.orig 2006-07-13 11:28:32.000000000 +0200
+++ scapy.py 2006-07-13 11:28:49.000000000 +0200
@@ -3761,7 +3761,7 @@
def __init__(self, name, default):
Field.__init__(self, name, default, "I")
def addfield(self, pkt, s, val):
- return s+struct.pack(self.fmt, self.i2m(pkt,val))[:3]
+ return s+struct.pack(self.fmt, self.i2m(pkt,val))[1:4]
def getfield(self, pkt, s):
return s[3:], self.m2i(pkt, struct.unpack(self.fmt, "\x00"+s[:3])[0])Attachments
Change History
Note: See
TracTickets for help on using
tickets.