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

Re: a typo in servers/slapd/sasl.c (ITS#665)



On Tue, 15 Aug 2000 mei@isi.edu wrote:

> Date: Tue, 15 Aug 2000 21:10:59 GMT
> From: mei@isi.edu
> To: openldap-its@OpenLDAP.org
> Subject: a typo in servers/slapd/sasl.c  (ITS#665)
> 
> Full_Name: mei-hui su
> Version: openldap 2.0 latest
> OS: solaris 2.7
> URL: ftp://ftp.openldap.org/incoming/
> Submission from: (NULL) (128.9.64.206)
> 
> 
> Hi,
> 
>  is this a typo ? around line #470   
> 
>     if( username == NULL || (
>             !strncasecmp( username, "anonymous", sizeof("anonyous")-1 ) &&
> <<---
>             ( ( username[sizeof("anonymous")] == '\0' ) ||
>               ( username[sizeof("anonymous")] == '@' ) ) ) )
>     {
> 
> 
> 
> mei
> 

As sizeof("anonymous") == 10 then you need to subtract one also in the
following two lines when used as an index to the end of the string.

             ( ( username[sizeof("anonymous")-1] == '\0' ) ||
               ( username[sizeof("anonymous")-1] == '@' ) ) ) )


The '@' or the trailing '\0' is expected at string position 9.


-- 
Villy