[ldns-users] Missing NULL check in ldns_rr_compare_ds

Max Liebkies mail at maxliebkies.de
Mon Jun 23 17:34:31 UTC 2014


Hi,

I recently stumbled over a segfault in the Python ldns wrapper in the
ldns_rr_compare_ds method. I seem to have been calling the method with
at least one argument being None. As the underlying C method clones both
ldns_rr structs first but doesn't check the return value of
ldns_rr_clone, the subsequent calls to ldns_rr_set_ttl will segfault.

How to reproduce with python:
>>> from ldns import ldns_rr_compare_ds
>>> ldns_rr_compare_ds(None, None)

Please see the attached patch for a fix in rr.c

Cheers,
Max

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_check_return_value_in_compare_ds.patch
Type: text/x-patch
Size: 445 bytes
Desc: fix_check_return_value_in_compare_ds.patch
URL: <http://lists.nlnetlabs.nl/pipermail/ldns-users/attachments/20140623/813f046a/attachment.bin>


More information about the ldns-users mailing list