mirror of
https://github.com/moparisthebest/socat
synced 2024-12-21 22:48:48 -05:00
Fixed return value of nestlex()
This commit is contained in:
parent
98028900e0
commit
0219d6ac27
2
CHANGES
2
CHANGES
@ -23,6 +23,8 @@ corrections:
|
|||||||
Test: ABSTRACT_BIND
|
Test: ABSTRACT_BIND
|
||||||
Thanks to Denis Shatov for reporting this bug.
|
Thanks to Denis Shatov for reporting this bug.
|
||||||
|
|
||||||
|
Fixed return value of nestlex()
|
||||||
|
|
||||||
####################### V 1.7.2.4:
|
####################### V 1.7.2.4:
|
||||||
|
|
||||||
corrections:
|
corrections:
|
||||||
|
61
xioopts.c
61
xioopts.c
@ -1826,7 +1826,11 @@ int parseopts_table(const char **a, unsigned int groups, struct opt **opts,
|
|||||||
parsres =
|
parsres =
|
||||||
nestlex(a, &tokp, &len, endkey, hquotes, squotes, nests,
|
nestlex(a, &tokp, &len, endkey, hquotes, squotes, nests,
|
||||||
true, true, false);
|
true, true, false);
|
||||||
if (parsres != 0) {
|
if (parsres < 0) {
|
||||||
|
Error1("option too long: \"%s\"", *a);
|
||||||
|
return -1;
|
||||||
|
} else if (parsres > 0) {
|
||||||
|
Error1("syntax error in \"%s\"", *a);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (tokp == token) {
|
if (tokp == token) {
|
||||||
@ -1861,7 +1865,11 @@ int parseopts_table(const char **a, unsigned int groups, struct opt **opts,
|
|||||||
parsres =
|
parsres =
|
||||||
nestlex(a, &tokp, &len, endval, hquotes, squotes, nests,
|
nestlex(a, &tokp, &len, endval, hquotes, squotes, nests,
|
||||||
true, true, false);
|
true, true, false);
|
||||||
if (parsres != 0) {
|
if (parsres < 0) {
|
||||||
|
Error1("option too long: \"%s\"", *a);
|
||||||
|
return -1;
|
||||||
|
} else if (parsres > 0) {
|
||||||
|
Error1("syntax error in \"%s\"", *a);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
*tokp = '\0';
|
*tokp = '\0';
|
||||||
@ -2339,9 +2347,17 @@ int parseopts_table(const char **a, unsigned int groups, struct opt **opts,
|
|||||||
/* parse first IP address, expect ':' */
|
/* parse first IP address, expect ':' */
|
||||||
tokp = token;
|
tokp = token;
|
||||||
/*! result= */
|
/*! result= */
|
||||||
nestlex((const char **)&tokp, &buffp, &bufspc,
|
parsres =
|
||||||
ends, NULL, NULL, nests,
|
nestlex((const char **)&tokp, &buffp, &bufspc,
|
||||||
true, false, false);
|
ends, NULL, NULL, nests,
|
||||||
|
true, false, false);
|
||||||
|
if (parsres < 0) {
|
||||||
|
Error1("option too long: \"%s\"", *a);
|
||||||
|
return -1;
|
||||||
|
} else if (parsres > 0) {
|
||||||
|
Error1("syntax error in \"%s\"", *a);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
if (*tokp != ':') {
|
if (*tokp != ':') {
|
||||||
Error1("syntax in option %s: missing ':'", token);
|
Error1("syntax in option %s: missing ':'", token);
|
||||||
}
|
}
|
||||||
@ -2352,9 +2368,17 @@ int parseopts_table(const char **a, unsigned int groups, struct opt **opts,
|
|||||||
/* parse second IP address, expect ':' or '\0'' */
|
/* parse second IP address, expect ':' or '\0'' */
|
||||||
buffp = buff;
|
buffp = buff;
|
||||||
/*! result= */
|
/*! result= */
|
||||||
nestlex((const char **)&tokp, &buffp, &bufspc,
|
parsres =
|
||||||
ends, NULL, NULL, nests,
|
nestlex((const char **)&tokp, &buffp, &bufspc,
|
||||||
true, false, false);
|
ends, NULL, NULL, nests,
|
||||||
|
true, false, false);
|
||||||
|
if (parsres < 0) {
|
||||||
|
Error1("option too long: \"%s\"", *a);
|
||||||
|
return -1;
|
||||||
|
} else if (parsres > 0) {
|
||||||
|
Error1("syntax error in \"%s\"", *a);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
*buffp++ = '\0';
|
*buffp++ = '\0';
|
||||||
(*opts)[i].value.u_ip_mreq.param2 = strdup(buff); /*!!! NULL */
|
(*opts)[i].value.u_ip_mreq.param2 = strdup(buff); /*!!! NULL */
|
||||||
|
|
||||||
@ -2392,9 +2416,17 @@ int parseopts_table(const char **a, unsigned int groups, struct opt **opts,
|
|||||||
char buff[512], *buffp=buff; size_t bufspc = sizeof(buff)-1;
|
char buff[512], *buffp=buff; size_t bufspc = sizeof(buff)-1;
|
||||||
|
|
||||||
tokp = token;
|
tokp = token;
|
||||||
|
parsres =
|
||||||
nestlex((const char **)&tokp, &buffp, &bufspc,
|
nestlex((const char **)&tokp, &buffp, &bufspc,
|
||||||
ends, NULL, NULL, nests,
|
ends, NULL, NULL, nests,
|
||||||
true, false, false);
|
true, false, false);
|
||||||
|
if (parsres < 0) {
|
||||||
|
Error1("option too long: \"%s\"", *a);
|
||||||
|
return -1;
|
||||||
|
} else if (parsres > 0) {
|
||||||
|
Error1("syntax error in \"%s\"", *a);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
if (*tokp != '\0') {
|
if (*tokp != '\0') {
|
||||||
Error1("trailing data in option \"%s\"", token);
|
Error1("trailing data in option \"%s\"", token);
|
||||||
}
|
}
|
||||||
@ -2841,6 +2873,7 @@ int retropt_bind(struct opt *opts,
|
|||||||
char *bindname, *bindp;
|
char *bindname, *bindp;
|
||||||
char hostname[512], *hostp = hostname, *portp = NULL;
|
char hostname[512], *hostp = hostname, *portp = NULL;
|
||||||
size_t hostlen = sizeof(hostname)-1;
|
size_t hostlen = sizeof(hostname)-1;
|
||||||
|
int parsres;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if (retropt_string(opts, OPT_BIND, &bindname) < 0) {
|
if (retropt_string(opts, OPT_BIND, &bindname) < 0) {
|
||||||
@ -2874,8 +2907,16 @@ int retropt_bind(struct opt *opts,
|
|||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
#endif /*WITH_IP6 */
|
#endif /*WITH_IP6 */
|
||||||
portallowed = (feats>=2);
|
portallowed = (feats>=2);
|
||||||
nestlex((const char **)&bindp, &hostp, &hostlen, ends, NULL, NULL, nests,
|
parsres =
|
||||||
true, false, false);
|
nestlex((const char **)&bindp, &hostp, &hostlen, ends, NULL, NULL, nests,
|
||||||
|
true, false, false);
|
||||||
|
if (parsres < 0) {
|
||||||
|
Error1("option too long: \"%s\"", bindp);
|
||||||
|
return STAT_NORETRY;
|
||||||
|
} else if (parsres > 0) {
|
||||||
|
Error1("syntax error in \"%s\"", bindp);
|
||||||
|
return STAT_NORETRY;
|
||||||
|
}
|
||||||
*hostp++ = '\0';
|
*hostp++ = '\0';
|
||||||
if (!strncmp(bindp, portsep, strlen(portsep))) {
|
if (!strncmp(bindp, portsep, strlen(portsep))) {
|
||||||
if (!portallowed) {
|
if (!portallowed) {
|
||||||
|
Loading…
Reference in New Issue
Block a user