Ugly, but logically it looks right:
diff -u apr_cpystrn.c.bak apr_cpystrn.c
--- apr_cpystrn.c.bak Fri Apr 5 14:17:32 2002
+++ apr_cpystrn.c Fri Apr 5 14:31:31 2002
@@ -171,9 +171,11 @@
while (*ct != '\0') {
CHECK_QUOTATION(ct, isquoted);
DETERMINE_NEXTSTRING(ct, isquoted);
- ct++;
numargs++;
- SKIP_WHITESPACE(ct);
+ if (*ct != '\0') {
+ ct++;
+ SKIP_WHITESPACE(ct);
+ }
}
*argv_out = apr_palloc(token_context, numargs * sizeof(char*));
@@ -183,11 +185,16 @@
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++;
- SKIP_WHITESPACE(cp);
+ if (*cp != '\0') {
+ cp++;
+ (*argv_out)[numargs] = apr_palloc(token_context, cp - ct);
+ apr_cpystrn((*argv_out)[numargs], ct, cp - ct);
+ SKIP_WHITESPACE(cp);
+ } else {
+ (*argv_out)[numargs] = apr_palloc(token_context, cp - ct + 1);
+ apr_cpystrn((*argv_out)[numargs], ct, cp - ct + 1);
+ }
}
(*argv_out)[numargs] = NULL;
--
===========================================================================
Jim Jagielski [|] [EMAIL PROTECTED] [|] http://www.jaguNET.com/
"A society that will trade a little liberty for a little order
will lose both and deserve neither" - T.Jefferson