apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Waite <m...@akuma.org>
Subject (repost) [PATCH] getopt long arguments
Date Fri, 02 Aug 2002 03:25:36 GMT
not on list, cc on replies)

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