[Dnsmasq-discuss] Dnsmasq-discuss Digest, Vol 163, Issue 27

Jeremy Allison jra at google.com
Fri Dec 21 00:17:41 GMT 2018


On 12/20/2018 03:36 PM, dnsmasq-discuss-request at lists.thekelleys.org.uk wrote:
> From: Paul Smith <paul at mad-scientist.net>
> To: dnsmasq-discuss at lists.thekelleys.org.uk
> Subject: Re: [Dnsmasq-discuss] Patch to cache SRV records - updated
> 	version.
> Message-ID:
> 	<f9d8fc547b0f7b123339d5c1d0e714ef51e36757.camel at mad-scientist.net>
> Content-Type: text/plain; charset="UTF-8"
> 
> On Thu, 2018-12-20 at 12:20 -0800, Jeremy Allison wrote:
>> Sigh. Found a bug when testing. free_mx_srv_record()
>> wasn't checking for NULL pointers on free(),
>> which can be the case for negative cache
>> records.
> 
> C has required free(NULL) to be a no-op since ANSI C 1989/ISO C 1990...
> Is dnsmasq still targetting C runtimes that don't adhere to that
> standard?
> 
> Just curious...

Unfortunately the crash was on a version I'd built without
symbols (since remedied in my testing). It's more possible it
was due to an previously freed SRV cache record entry being
re-used (as the free_mx_srv_record() was calling free on
the string pointers, but not nulling them out afterwards).

The version #3 of the code now nulls out the name and target
pointers inside free_mx_srv_record(), as well as null-initializing
any negative SRV entry cache records and I'm now testing
it under valgrind and haven't seen any issues yet.

I'll keep testing though.

Jeremy.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20181220/cfc20b18/attachment.sig>


More information about the Dnsmasq-discuss mailing list