GNU bug report logs - #25757
Fix segfault when adns_strerror() is called with a value, for which there is no message defined

Previous Next

Package: adns;

Reported by: Tomas Hozza <thozza <at> redhat.com>

Date: Thu, 16 Feb 2017 16:36:02 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Ian Jackson <ijackson <at> chiark.greenend.org.uk>
To: Tomas Hozza <thozza <at> redhat.com>
Cc: 25757 <at> debbugs.gnu.org
Subject: bug#25757: Fix segfault when adns_strerror() is called with a value, for which there is no message defined
Date: Mon, 27 Feb 2017 17:29:29 +0000
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.




This bug report was last modified 8 years and 112 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.