[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#4292) strerror bug with openldap 2.3.11->2.3.14

Full_Name: Aaron Brace
Version: 2.3.11
OS: Solaris
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (

The NULL bug with strerror that was marked as fixed with 2.3.14 was not fixed
properly in my belief. 

In line 109 if string.h it used to be (with 2.3.11):
#       define AC_STRERROR_R(e,b,l)             (strerror_r((e), (b), (l)) ? (b)
It was recently changed to the following in 2.3.14:
#       define AC_STRERROR_R(e,b,l)             (strerror_r((e), (b), (l)) ? (b)
: "")

When in fact I believe the actual bug is that the (b) : "" is reversed. The line
should be as follows:

#       define AC_STRERROR_R(e,b,l)             (strerror_r((e), (b), (l)) ? ""
: (b))

This is because strerror_r only returns a positive value if itself had an error
(inability to look up error number, etc). It normally returns a "0". This means
that currently when strerror is able to find text for the supplied error number,
the code is subbing out the error with the "" instead of the actual error
(previous versions was subbing out a NULL, causing a segfault on the print).
When it is UNABLE to find the error text, the code now returns B. If the logic
after the "?" is reversed, then it will operate as expected.