Re: libspf2 crash

Ladar Levison <[email protected]> Fri, 09 May 2008 14:12:38 -0500
Newsgroups gmane.mail.spam.spf.devel
Message-ID <[email protected]>
Eugene Crosser wrote:
> Ladar Levison wrote:
>
>>>> I'm seeing a number of segfaults. I believe the issue is that 
>>>> libreplace
> [...]
>> The issue appears to occur sporadically with certain domains. One 
>> such example is yourshirevillage.com, and it, like the others, lists
>>  "mx" in the SPF record, and then has a couple hundred MX records 
>> listed. I believe the issue is that a corrupted DNS result is being 
>> returned, and that's what's triggering the segfault. I haven't been 
>> able to figure it out completely yet.
>
> Do you have this patch applied to libspf2? Without it, it segfaults
> consistently on a number of domains, that have "unusual" but
> syntactically valid TXT RR.
>
> --- src/libspf2/spf_dns_resolv.c.orig   2005-02-19 05:38:12.000000000 
> +0300
> +++ src/libspf2/spf_dns_resolv.c        2007-11-03 11:54:03.000000000 
> +0300
> @@ -399,6 +399,10 @@
>                                 while ( rdlen > 0 )
>                                 {
>                                 len = *src;
> +                               /* zero length element? must be 
> terminator */
> +                               if (len == 0) break;
> +                               /* element longer than buffer? corrupt 
> data */
> +                               if (len >= rdlen) break;
>                                 src++;
>                                 memcpy( dst, src, len );
>                                 dst += len;
>
> Eugene
Yes I do. This appears to be a different bug.