Issue 55 in dpkt: dpkt.ip.IP constructor generates packet with incorrect 'len' field.

10 views
Skip to first unread message

dp...@googlecode.com

unread,
Dec 9, 2010, 5:06:35 AM12/9/10
to dp...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 55 by googa...@jlm.ofb.net: dpkt.ip.IP constructor generates
packet with incorrect 'len' field.
http://code.google.com/p/dpkt/issues/detail?id=55

What steps will reproduce the problem?
### Begin sample code ###
from dpkt import ip

ip1 = ip.IP(data="Hello world!")
ip2 = ip.IP(str(ip1))
ip1.len = ip1.len + 12
ip3 = ip.IP(str(ip1))
print repr(str(ip1))
print repr(str(ip2))
print repr(str(ip3))

### End sample code ###

What is the expected output? What do you see instead?
Expect ip1 to be the same as ip2, ip3 to have a 'len' field 12 too large.
Actual ip2 is truncated to have no payload, ip3 is same as ip1.


What version of the product are you using? On what operating system?
dpkt 1.6 on Ubuntu 10.10 (package 1.6+svn54-1)


Please provide any additional information below.

dp...@googlecode.com

unread,
Mar 10, 2015, 10:54:53 AM3/10/15
to dp...@googlegroups.com

Comment #1 on issue 55 by pchemist...@gmail.com: dpkt.ip.IP constructor
generates packet with incorrect 'len' field.
https://code.google.com/p/dpkt/issues/detail?id=55

Instead of using the len field direcly, first calculate it through the
__len__()
and then use the value.
here is a suggested patch


Attachments:
fix_issue_55.patch 1.8 KB

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
Reply all
Reply to author
Forward
0 new messages