Ticket #6 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

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

Changed 4 years ago by pbi

  • status changed from new to closed
  • resolution set to fixed

applied.

Add/Change #6 (wrong index in X3BytesField.addfield())

Author


E-mail address and user name can be saved in the Preferences.


Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.