- Fixed a bug in short-opt parsing when an abutting arg has an '='.
- Allow a short-opt to be separated from its arg by an '='.
- Avoid an IBM-checker warning about an impossible case in a switch
and a warning about a potential NULL-pointer dereference.
- Fixed a memory leak.
*oe++ = '\0';
/* XXX longArg is mapped back to persistent storage. */
longArg = origOptString + (oe - localOptString);
*oe++ = '\0';
/* XXX longArg is mapped back to persistent storage. */
longArg = origOptString + (oe - localOptString);
opt = findOption(con->options, optString, '\0', &cb, &cbData,
singleDash);
if (!opt && !singleDash)
return POPT_ERROR_BADOPT;
opt = findOption(con->options, optString, '\0', &cb, &cbData,
singleDash);
if (!opt && !singleDash)
return POPT_ERROR_BADOPT;
+ if (!opt && oe)
+ oe[-1] = '='; /* restore overwritten '=' */
}
if (!opt) {
con->os->nextCharArg = origOptString + 1;
}
if (!opt) {
con->os->nextCharArg = origOptString + 1;
} else {
if (con->os == con->optionStack &&
opt->argInfo & POPT_ARGFLAG_STRIP)
} else {
if (con->os == con->optionStack &&
opt->argInfo & POPT_ARGFLAG_STRIP)
origOptString++;
if (*origOptString != '\0')
origOptString++;
if (*origOptString != '\0')
- con->os->nextCharArg = origOptString;
+ con->os->nextCharArg = origOptString + (*origOptString == '=');
if (opt->argDescrip) return D_(translation_domain, opt->argDescrip);
switch (opt->argInfo & POPT_ARG_MASK) {
if (opt->argDescrip) return D_(translation_domain, opt->argDescrip);
switch (opt->argInfo & POPT_ARG_MASK) {
- case POPT_ARG_NONE: return POPT_("NONE");
+ /*case POPT_ARG_NONE: return POPT_("NONE");*/ /* impossible */
#ifdef DYING
case POPT_ARG_VAL: return POPT_("VAL");
#else
#ifdef DYING
case POPT_ARG_VAL: return POPT_("VAL");
#else
char * s = (str != NULL ? str : memset(alloca(300), 0, 300));
int len = 0;
char * s = (str != NULL ? str : memset(alloca(300), 0, 300));
int len = 0;
+ if (s == NULL)
+ return 0;
+
/*@-boundswrite@*/
if (opt != NULL)
for (; (opt->longName || opt->shortName || opt->arg); opt++) {
/*@-boundswrite@*/
if (opt != NULL)
for (; (opt->longName || opt->shortName || opt->arg); opt++) {
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 */
if (*p == '\0' || *p == '\n') continue; /* line is empty */
if (*p == '#') continue; /* comment line */