bug#25757: Fix segfault when adns_strerror() is called with a value, for which there is no message defined
Ian Jackson
ijackson at chiark.greenend.org.uk
Mon Feb 27 17:29:29 GMT 2017
Tomas Hozza writes ("bug#25757: Fix segfault when adns_strerror() is called with a value, for which there is no message defined"):
> In Fedora, we are carrying a downstream patch to fix segfault when adns_strerror() is called with a value, for which there is no message defined. You can find more info in https://bugzilla.redhat.com/show_bug.cgi?id=514838
Hi. Thanks for getting in touch.
> It would be great if you could consider including this change also in the upstream sources. If you have any questions, please reach out to me.
The bug report gives a step to reproduce of
printf("%s\n", adns_strerror(100));
But the documentation for adns_strerror in adns.h says
You MUST NOT call these functions with status values
not returned by the same adns library.
So I think this test case is caller error. Presumably there was some
real application that went wrong, but the bug report doesn't say what
the motivation or context was for this change.
It would perhaps be possible to improve adns here to make this use
not segfault, but:
* I don't think it would be right to return a fixed string,
for different error codes (since the caller might print the
string _instead of_ the invalid error code)
* Variable strings would have to be allocated somewhere and
there is nowhere suitable
* So probably adns_strerror would return NULL, rather than crashing,
which is perhaps preferable but not much of an improvement.
Regards,
Ian.
More information about the adns-discuss
mailing list