#3 Bug in DNS.Lib.Unpacker.getbyte()

open
nobody
None
5
2004-05-14
2004-05-14
Jon Ribbens
No

In Lib.py, the line in getbyte():

if self.offset > len(self.buf):

should be:

if self.offset >= len(self.buf):

Discussion

  • Logged In: YES
    user_id=1300068
    Originator: NO

    Jon,

    If you are still interested in pydns...

    I am working on fixing bugs in pydns for Ubuntu. If you could give me a little more detail on what problems this causes and how to recreate the problem/verify the fix, I'd be interested in including this. My hope is to get all the upstream bugs (plus the Debian/Ubuntu ones I've fixed already) into an updated package in the next few weeks.

    Thanks,

    Scott K

     
  • Jon Ribbens
    Jon Ribbens
    2007-01-25

    Logged In: YES
    user_id=76089
    Originator: YES

    Sorry, 2.5 years later I can't remember the specific circumstances. I assume it caused a problem with some query or other I was doing.

    However, if you examine the code it is easy to verify the bug and fix without needing to inspect the rest of the program:

    if self.offset > len(self.buf):
    raise UnpackError, "Ran off end of data"
    c = self.buf[self.offset]

    If n == len(buf), buf[n] is invalid, so the check should be >= not > .

     
  • Logged In: YES
    user_id=1300068
    Originator: NO

    Thanks. I know it's been a long time. I patched pydns for a small bug that got me and packaged it for Ubuntu, so for the moment I'm inspired to try and tackle the rest.

    Scott K

     
  • Logged In: YES
    user_id=1300068
    Originator: NO

    Fixed in 2.3.1

     
  • This is fixed in the latest pydns and py3dns.