On Fri, 5 Apr 2002, Jim Jagielski wrote:
> Making sure everyone sees the comment at the end :)
Yep, saw it. Here's a revised version for your patching convenience:
Index: apr_cpystrn.c
===================================================================
RCS file: /home/cvs/apr/strings/apr_cpystrn.c,v
retrieving revision 1.10
diff -u -d -r1.10 apr_cpystrn.c
--- apr_cpystrn.c 13 Mar 2002 20:39:26 -0000 1.10
+++ apr_cpystrn.c 5 Apr 2002 19:42:51 -0000
@@ -126,7 +126,7 @@
{
const char *cp;
const char *ct;
- int isquoted, numargs = 0;
+ int isquoted, numargs = 0, argnum;
#define SKIP_WHITESPACE(cp) \
for ( ; *cp == ' ' || *cp == '\t'; ) { \
@@ -171,25 +171,25 @@
while (*ct != '\0') {
CHECK_QUOTATION(ct, isquoted);
DETERMINE_NEXTSTRING(ct, isquoted);
- ct++;
+ if (*ct != '\0') {
+ ct++;
+ }
numargs++;
SKIP_WHITESPACE(ct);
}
*argv_out = apr_palloc(token_context, numargs * sizeof(char*));
/* determine first argument */
- numargs = 0;
- while (*cp != '\0') {
+ for (argnum = 0; argnum < (numargs-1); argnum++) {
CHECK_QUOTATION(cp, isquoted);
ct = cp;
DETERMINE_NEXTSTRING(cp, isquoted);
cp++;
- (*argv_out)[numargs] = apr_palloc(token_context, cp - ct);
- apr_cpystrn((*argv_out)[numargs], ct, cp - ct);
- numargs++;
+ (*argv_out)[argnum] = apr_palloc(token_context, cp - ct);
+ apr_cpystrn((*argv_out)[argnum], ct, cp - ct);
SKIP_WHITESPACE(cp);
}
- (*argv_out)[numargs] = NULL;
+ (*argv_out)[argnum] = NULL;
return APR_SUCCESS;
}
--------------------------------------------------------------
Cliff Woolley
[EMAIL PROTECTED]
Charlottesville, VA