Issue 656 - numericStringNormalize easily asserts
Summary: numericStringNormalize easily asserts
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: 2000-08-11 13:31 UTC by Mark Adamson
Modified: 2014-08-01 21:05 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 Mark Adamson 2000-08-11 13:31:26 UTC
My OpenLDAP 2.0 slapd was core dumping in numericStringNormalize() in
servers/slapd/schema_init.c. The code points "char *p" and "char *q" to
the string, then reads it with "p" and recopies it at "q". If "p" 
sees a space, it jumps ahead without copying or advancing "q". 

If there are any spaces in the string, p will get ahead of q. After the
copy, there are 3 assert()'s, and the third one, assert( p <= q ), will
hit. Although none of these assert()'s should ever hit, the logic of
that one is backwards. It should check q <= p. The $0.10 patch for version
1.64 of the file is:


--- schema_init.cold    Fri Aug 11 09:20:11 2000
+++ schema_init.c       Fri Aug 11 09:21:40 2000
@@ -419,7 +419,7 @@
 
        assert( *newval->bv_val );
        assert( newval->bv_val < p );
-       assert( p <= q );
+       assert( q <= p );
 
        /* cannot start with a space */
        assert( !ldap_utf8_isspace(newval->bv_val) );




  -Mark Adamson
   Carnegie Mellon

Comment 1 Kurt Zeilenga 2000-08-11 17:24:17 UTC
Applied, please test, thanks.

At 01:31 PM 8/11/00 +0000, adamson@andrew.cmu.edu wrote:
>My OpenLDAP 2.0 slapd was core dumping in numericStringNormalize() in
>servers/slapd/schema_init.c. The code points "char *p" and "char *q" to
>the string, then reads it with "p" and recopies it at "q". If "p" 
>sees a space, it jumps ahead without copying or advancing "q". 
>
>If there are any spaces in the string, p will get ahead of q. After the
>copy, there are 3 assert()'s, and the third one, assert( p <= q ), will
>hit. Although none of these assert()'s should ever hit, the logic of
>that one is backwards. It should check q <= p. The $0.10 patch for version
>1.64 of the file is:
>
>
>--- schema_init.cold    Fri Aug 11 09:20:11 2000
>+++ schema_init.c       Fri Aug 11 09:21:40 2000
>@@ -419,7 +419,7 @@
> 
>        assert( *newval->bv_val );
>        assert( newval->bv_val < p );
>-       assert( p <= q );
>+       assert( q <= p );
> 
>        /* cannot start with a space */
>        assert( !ldap_utf8_isspace(newval->bv_val) );
>
>
>
>
>  -Mark Adamson
>   Carnegie Mellon

Comment 2 Kurt Zeilenga 2000-08-12 23:03:52 UTC
changed notes
changed state Open to Closed
moved from Incoming to Development
Comment 3 OpenLDAP project 2014-08-01 21:05:27 UTC
fixed.