exported / dpkt

Automatically exported from code.google.com/p/dpkt
Other
0 stars 0 forks source link

import IP protocols can import modules from other packages and fail. #115

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
If you have installed a python module somewhere on your path that has the same 
name as a protocol listed on the ip.py module (like IP_PROTO_ROUTING attempts 
to import the "routing" module) your module could be imported in dpkt instead 
of the intended one, and latter fail because protocol.PROTOCOL is expected.

To fix this, we need to pass levels=0 to the __import__ on ip.py. Attached is 
the patch to fix this with an extra check.

Thanks :)

Original issue reported on code.google.com by de...@chromium.org on 10 Oct 2013 at 6:30

Attachments:

GoogleCodeExporter commented 9 years ago
Hi again!
The actual fix for this problem is passing level=1 to the __import__ .

See the patch we added in chromium:
https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/HEAD/
dev-python/dpkt/files/dpkt-1.8-fix-ip-import.patch

Original comment by de...@chromium.org on 22 Oct 2013 at 2:16