Fixed bad parser error message on "socat /tmp/x\"x/x -"

This commit is contained in:
Gerhard Rieger 2022-04-15 11:23:47 +02:00
parent 75cb44bc90
commit 88cdeed092
2 changed files with 14 additions and 5 deletions

View file

@ -31,6 +31,8 @@ Corrections:
instead of a free port in range 640..1023 instead of a free port in range 640..1023
Test: UDP_LOWPORT Test: UDP_LOWPORT
Fixed bad parser error message on "socat /tmp/x\"x/x -"
Porting: Porting:
OpenSSL, at least 1.1 on Ubuntu, crashed with SIGSEGV under certain OpenSSL, at least 1.1 on Ubuntu, crashed with SIGSEGV under certain
conditions: client connection to server with certificate with empty conditions: client connection to server with certificate with empty

View file

@ -494,6 +494,7 @@ static xiosingle_t *xioparse_single(const char **addr) {
char token[512], *tokp; char token[512], *tokp;
size_t len; size_t len;
int i; int i;
int result;
/* init */ /* init */
i = 0; i = 0;
@ -510,9 +511,12 @@ static xiosingle_t *xioparse_single(const char **addr) {
sfd->argc = 0; sfd->argc = 0;
len = sizeof(token); tokp = token; len = sizeof(token); tokp = token;
if (nestlex(addr, &tokp, &len, ends, hquotes, squotes, nests, result = nestlex(addr, &tokp, &len, ends, hquotes, squotes, nests,
true, true, false) < 0) { true, true, false);
if (result < 0) {
Error2("keyword too long, in address \"%s%s\"", token, *addr); Error2("keyword too long, in address \"%s%s\"", token, *addr);
} else if (result > 0){
Error1("unexpected end of address \"%s\"", *addr);
} }
*tokp = '\0'; /*! len? */ *tokp = '\0'; /*! len? */
ae = (struct addrname *) ae = (struct addrname *)
@ -564,9 +568,12 @@ static xiosingle_t *xioparse_single(const char **addr) {
while (!strncmp(*addr, xioopts.paramsep, strlen(xioopts.paramsep))) { while (!strncmp(*addr, xioopts.paramsep, strlen(xioopts.paramsep))) {
*addr += strlen(xioopts.paramsep); *addr += strlen(xioopts.paramsep);
len = sizeof(token); tokp = token; len = sizeof(token); tokp = token;
if (nestlex(addr, &tokp, &len, ends, hquotes, squotes, nests, result = nestlex(addr, &tokp, &len, ends, hquotes, squotes, nests,
true, true, false) != 0) { true, true, false);
Error1("syntax error in address \"%s\"", addr0); if (result < 0) {
Error1("address \"%s\" too long", addr0);
} else if (result > 0){
Error1("unexpected end of address \"%s\"", addr0);
} }
*tokp = '\0'; *tokp = '\0';
if ((sfd->argv[sfd->argc++] = strdup(token)) == NULL) { if ((sfd->argv[sfd->argc++] = strdup(token)) == NULL) {