Issue 4292 - strerror bug with openldap 2.3.11->2.3.14
Summary: strerror bug with openldap 2.3.11->2.3.14
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-30 17:02 UTC by abrace@mcio.org
Modified: 2014-08-01 21:06 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description abrace@mcio.org 2005-12-30 17:02:35 UTC
Full_Name: Aaron Brace
Version: 2.3.11
OS: Solaris
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (68.168.117.30)


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)
: NULL)
  
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.


Comment 1 abrace@mcio.org 2005-12-30 17:44:10 UTC
Here is a diff of the changes for clarity:

--- string.h    Fri Dec 23 15:54:42 2005
+++ ../../../../openldap-2.3.14/include/ac/string.h     Fri Dec 30 
17:14:41 2005
@@ -106,7 +106,7 @@
  #if defined( HAVE_NONPOSIX_STRERROR_R )
  #      define AC_STRERROR_R(e,b,l)             (strerror_r((e), (b), 
(l)))
  #elif defined( HAVE_STRERROR_R )
-#      define AC_STRERROR_R(e,b,l)             (strerror_r((e), (b), (l)) 
? (b) : "")
+#      define AC_STRERROR_R(e,b,l)             (strerror_r((e), (b), (l)) 
? "" : (b))
  #elif defined( HAVE_SYS_ERRLIST )
  #      define AC_STRERROR_R(e,b,l)             ((e) > -1 && (e) < 
sys_nerr \

? sys_errlist[(e)] : "" )


On Fri, 30 Dec 2005, openldap-its@OpenLDAP.org wrote:

>
> *** THIS IS AN AUTOMATICALLY GENERATED REPLY ***
>
> Thanks for your report to the OpenLDAP Issue Tracking System.  Your
> report has been assigned the tracking number ITS#4292.
>
> One of our support engineers will look at your report in due course.
> Note that this may take some time because our support engineers
> are volunteers.  They only work on OpenLDAP when they have spare
> time.
>
> If you need to provide additional information in regards to your
> issue report, you may do so by replying to this message.  Note that
> any mail sent to openldap-its@openldap.org with (ITS#4292)
> in the subject will automatically be attached to the issue report.
>
> 	mailto:openldap-its@openldap.org?subject=(ITS#4292)
>
> You may follow the progress of this report by loading the following
> URL in a web browser:
>    http://www.OpenLDAP.org/its/index.cgi?findid=4292
>
> Please remember to retain your issue tracking number (ITS#4292)
> on any further messages you send to us regarding this report.  If
> you don't then you'll just waste our time and yours because we
> won't be able to properly track the report.
>
> Please note that the Issue Tracking System is not intended to
> be used to seek help in the proper use of OpenLDAP Software.
> Such requests will be closed.
>
> OpenLDAP Software is user supported.
> 	http://www.OpenLDAP.org/support/
>
> --------------
> Copyright 1998-2005 The OpenLDAP Foundation, All Rights Reserved.
>

Comment 2 ando@openldap.org 2006-01-02 08:47:39 UTC
changed notes
changed state Open to Test
moved from Incoming to Software Bugs
Comment 3 Kurt Zeilenga 2006-01-02 16:58:06 UTC
changed notes
changed state Test to Release
Comment 4 Kurt Zeilenga 2006-01-04 23:18:36 UTC
changed notes
changed state Release to Closed
Comment 5 Howard Chu 2009-02-17 05:17:20 UTC
moved from Software Bugs to Archive.Software Bugs
Comment 6 OpenLDAP project 2014-08-01 21:06:41 UTC
GNU logic is reversed wrt. POSIX
fixed in HEAD,re23