Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Some deny-rsync fixes:
[rsync/rsync.git]
/
popt
/
poptparse.c
diff --git
a/popt/poptparse.c
b/popt/poptparse.c
index
ccc2ac8
..
e003a04
100644
(file)
--- a/
popt/poptparse.c
+++ b/
popt/poptparse.c
@@
-8,6
+8,8
@@
#include "system.h"
#include "system.h"
+#include "poptint.h"
+
#define POPT_ARGV_ARRAY_GROW_DELTA 5
/*@-boundswrite@*/
#define POPT_ARGV_ARRAY_GROW_DELTA 5
/*@-boundswrite@*/
@@
-81,7
+83,7
@@
int poptParseArgvString(const char * s, int * argcPtr, const char *** argvPtr)
if (*src != quote) *buf++ = '\\';
}
*buf++ = *src;
if (*src != quote) *buf++ = '\\';
}
*buf++ = *src;
- } else if (is
space(*
src)) {
+ } else if (is
Space(
src)) {
if (*argv[argc] != '\0') {
buf++, argc++;
if (argc == argvAlloced) {
if (*argv[argc] != '\0') {
buf++, argc++;
if (argc == argvAlloced) {
@@
-157,25
+159,27
@@
int poptConfigFileToString(FILE *fp, char ** argstrp, /*@unused@*/ UNUSED(int fl
p = line;
/* loop until first non-space char or EOL */
p = line;
/* loop until first non-space char or EOL */
- while( *p != '\0' && is
space(*
p) )
+ while( *p != '\0' && is
Space(
p) )
p++;
linelen = strlen(p);
p++;
linelen = strlen(p);
- if (linelen >= maxlinelen-1)
+ if (linelen >= maxlinelen-1) {
+ free(argstr);
return POPT_ERROR_OVERFLOW; /* XXX line too long */
return POPT_ERROR_OVERFLOW; /* XXX line too long */
+ }
if (*p == '\0' || *p == '\n') continue; /* line is empty */
if (*p == '#') continue; /* comment line */
q = p;
if (*p == '\0' || *p == '\n') continue; /* line is empty */
if (*p == '#') continue; /* comment line */
q = p;
- while (*q != '\0' && (!is
space(*
q)) && *q != '=')
+ while (*q != '\0' && (!is
Space(
q)) && *q != '=')
q++;
q++;
- if (is
space(*
q)) {
+ if (is
Space(
q)) {
/* a space after the name, find next non space */
*q++='\0';
/* a space after the name, find next non space */
*q++='\0';
- while( *q != '\0' && is
space((int)*
q) ) q++;
+ while( *q != '\0' && is
Space(
q) ) q++;
}
if (*q == '\0') {
/* single command line option (ie, no name=val, just name) */
}
if (*q == '\0') {
/* single command line option (ie, no name=val, just name) */
@@
-186,8
+190,8
@@
int poptConfigFileToString(FILE *fp, char ** argstrp, /*@unused@*/ UNUSED(int fl
argstr = realloc(argstr, maxargvlen);
if (argstr == NULL) return POPT_ERROR_MALLOC;
}
argstr = realloc(argstr, maxargvlen);
if (argstr == NULL) return POPT_ERROR_MALLOC;
}
- str
cat(argstr, " --"
);
- str
cat(argstr, p
);
+ str
lcat(argstr, " --", maxargvlen
);
+ str
lcat(argstr, p, maxargvlen
);
continue;
}
if (*q != '=')
continue;
}
if (*q != '=')
@@
-197,14
+201,14
@@
int poptConfigFileToString(FILE *fp, char ** argstrp, /*@unused@*/ UNUSED(int fl
*q++ = '\0';
/* find next non-space letter of value */
*q++ = '\0';
/* find next non-space letter of value */
- while (*q != '\0' && is
space(*
q))
+ while (*q != '\0' && is
Space(
q))
q++;
if (*q == '\0')
continue; /* XXX silently ignore missing value */
/* now, loop and strip all ending whitespace */
x = p + linelen;
q++;
if (*q == '\0')
continue; /* XXX silently ignore missing value */
/* now, loop and strip all ending whitespace */
x = p + linelen;
- while (is
space(*
--x))
+ while (is
Space(
--x))
*x = 0; /* null out last char if space (including fgets() NL) */
/* rest of line accept */
*x = 0; /* null out last char if space (including fgets() NL) */
/* rest of line accept */
@@
-215,11
+219,11
@@
int poptConfigFileToString(FILE *fp, char ** argstrp, /*@unused@*/ UNUSED(int fl
argstr = realloc(argstr, maxargvlen);
if (argstr == NULL) return POPT_ERROR_MALLOC;
}
argstr = realloc(argstr, maxargvlen);
if (argstr == NULL) return POPT_ERROR_MALLOC;
}
- str
cat(argstr, " --"
);
- str
cat(argstr, p
);
- str
cat(argstr, "=\""
);
- str
cat(argstr, q
);
- str
cat(argstr, "\""
);
+ str
lcat(argstr, " --", maxargvlen
);
+ str
lcat(argstr, p, maxargvlen
);
+ str
lcat(argstr, "=\"", maxargvlen
);
+ str
lcat(argstr, q, maxargvlen
);
+ str
lcat(argstr, "\"", maxargvlen
);
}
*argstrp = argstr;
}
*argstrp = argstr;