Re: smtpd w/ async DNS

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Peter J. Philipp
Date: Saturday, October 30, 2010 - 10:26 am

On Sat, Oct 30, 2010 at 05:28:42PM +0200, Gilles Chehade wrote:

I had a look at the pack.c file where the DNS compression is being handled.
It looks good to me.  But I have one concern that needs to be confirmed.
In function dname_expand() on lines:

    54                          ptr = 256 * (n & ~0xc0) + data[offset + 1];
    55                          if (ptr >= offset)
    56                                  return (-1);

The pointer is checked against offset meaning that a compression loop can't 
occur.  This is good.  However what happens if you have a DNS reply packet
with a name with two labels in it, one being a normal label of a name and the 
second being a compression pointer that points back to the first label, 
kinda like so..

[8]centroid[C0 back to 8]

I'm worried it might go into an infinite loop or crash even.

Perhaps it should check that it cannot go back to a label inside a dns name that
is being parsed.

Otherwise rockin' code!  I don't understand it all but the little I do it looks
really high quality!

-peter
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
smtpd w/ async DNS, Gilles Chehade, (Thu Oct 14, 7:47 am)
Re: smtpd w/ async DNS, Ted Unangst, (Thu Oct 14, 8:06 am)
Re: smtpd w/ async DNS, Mike Belopuhov, (Thu Oct 14, 8:10 am)
Re: smtpd w/ async DNS, Gilles Chehade, (Thu Oct 14, 8:17 am)
Re: smtpd w/ async DNS, Ted Unangst, (Thu Oct 14, 8:30 am)
Re: smtpd w/ async DNS, Christiano F. Haesbaert, (Thu Oct 14, 8:37 am)
Re: smtpd w/ async DNS, Gilles Chehade, (Thu Oct 14, 8:39 am)
Re: smtpd w/ async DNS, Christian Weisgerber, (Thu Oct 14, 8:59 am)
Re: smtpd w/ async DNS, Peter J. Philipp, (Thu Oct 14, 9:50 am)
Re: smtpd w/ async DNS, Mike Belopuhov, (Thu Oct 14, 11:57 am)
Re: smtpd w/ async DNS, Matthew Dempsky, (Thu Oct 14, 2:08 pm)
Re: smtpd w/ async DNS, Gilles Chehade, (Fri Oct 15, 1:50 am)
Re: smtpd w/ async DNS, Damien Miller, (Fri Oct 15, 2:38 am)
Re: smtpd w/ async DNS, Gilles Chehade, (Sat Oct 30, 7:55 am)
Re: smtpd w/ async DNS, Peter J. Philipp, (Sat Oct 30, 8:23 am)
Re: smtpd w/ async DNS, Gilles Chehade, (Sat Oct 30, 8:28 am)
Re: smtpd w/ async DNS, Peter J. Philipp, (Sat Oct 30, 10:26 am)
Re: smtpd w/ async DNS, Eric Faurot, (Sat Oct 30, 12:26 pm)