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

RE: Segmentation faults and malloc checkers



I've committed a fix for this.

  -- Howard Chu
  Chief Architect, Symas Corp.       Director, Highland Sun
  http://www.symas.com               http://highlandsun.com/hyc
  Symas: Premier OpenSource Development and Support 

> -----Original Message-----
> From: Simon Wilkinson [mailto:sxw@sxw.org.uk]
> Sent: Friday, April 26, 2002 12:55 PM
> To: Howard Chu; openldap-devel@OpenLDAP.org
> Subject: Re: Segmentation faults and malloc checkers
> 
> 
> On Friday 26 April 2002 05:53, Howard Chu wrote:
> > Optimization or not, this sounds suspicious to me. Pointing 
> them out would
> > be a good start.
> 
> sasl_getdn in sasl.c has:
>         if( id &&
>                 ( id[sizeof( "anonymous" )-1] == '\0'
>                         || id[sizeof( "anonymous" )-1] == '@' ) &&
>                 !strncasecmp( id, "anonymous", sizeof( 
> "anonymous" )-1) ) {
> 
> If strlen(id)<sizeof("anonymous")-1 then the two subsequent 
> checks read off 
> the end of the id string.
> 
> For debugging, I've fixed this by changing the first line to:
> 
> if (id && strlen(id)<(sizeof(anonymous)-1) && 
> 
> You could also solve it by reordering, so that the strncasecmp comes 
> immediately after the test on 'id'.
> 
> Cheers,
> 
> Simon.
> 
> -- 
> Simon Wilkinson            <simon@sxw.org.uk>          
http://www.sxw.org.uk
"Go not to the elves for counsel, for they will say both yes and no.
-- J.R.R. Tolkien