apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Holsman <i...@apache.org>
Subject Re: (repost) [PATCH] getopt long arguments
Date Fri, 02 Aug 2002 16:30:59 GMT
David Waite wrote:
> not on list, cc on replies)
> 
Thanks David.
your patch has been comitted.

Regards
Ian

> The documentation within include/apr_getopt.h says that the name
> argument within the option structure should be NULL if a long name is
> not present - but it performs a strlen on that value without checking
> for NULL.
> 
> -David Waite
> 
> RCS file: /home/cvspublic/apr/misc/unix/getopt.c,v
> retrieving revision 1.35
> diff -r1.35 getopt.c
> 240,243c240,246
> <         len = strlen(opts[i].name);
> <         if (strncmp(p, opts[i].name, len) == 0
> <             && (p[len] == '\0' || p[len] == '='))
> <             break;
> ---
>  >                 if (opts[i].name)
>  >                 {
>  >                     len = strlen(opts[i].name);
>  >                     if (strncmp(p, opts[i].name, len) == 0
>  >                         && (p[len] == '\0' || p[len] == '='))
>  >                         break;
>  >                 }
> 




Mime
View raw message