[Dnsmasq-discuss] Crashes with 2.16?

Simon Kelley simon@thekelleys.org.uk
Wed, 17 Nov 2004 13:19:45 +0000


Rory Campbell-Lange wrote:
> Thanks for this, Simon.
> 
> We have upgraded to 2.17 and have experienced no problems thus far.
> 
> What was the problem?
> 

Failure to check the return code from a call to insert a name into the 
cache.

DNSmasq is designed not to need to do memory allocation during normal 
operation of the DNS server. To do that it pre-allocates cache slots, 
and to avoid wasting memory it only allocates enough memory for DNS 
names which are forty characters or less. There is a small pool of cache 
slots which can hold maximally-sized names. That pool is limited to 10% 
of the total cache size. Cache insertion can only fail if that pool is 
full and a long name is being inserted.

Some new code was added in 2.16 which puts CNAMEs into the cache. It 
didn't check to see if the insertion failed, but carried on regardless, 
causing a segmentation fault.

So to hit this bug, there had to be a full complement of long names 
filling the cache, and then a DNS reply had to arrive containing a CNAME 
for a long name. In the core file which Steve Grecni managed to get for 
me, the offending name was v5statswindowsupdate.microsoft.nsatc.net, 
which just goes to prove that microsoft is the source of all evil :-)


Cheers,

Simon.