Fix stack smashing error

This commit is contained in:
wbaumann 2016-04-04 16:52:02 +00:00
parent 6b798f4abd
commit 9b5ef1e835
2 changed files with 25 additions and 6 deletions

View File

@ -1,6 +1,10 @@
ChangeLog for davfs2 ChangeLog for davfs2
-------------------- --------------------


2016-04-04 Werner Baumann (werner.baumann@onlinehome.de)
* mount_davfs.c, parse_line:
Fix stack smashing error.

2015-04-20 Werner Baumann (werner.baumann@onlinehome.de) 2015-04-20 Werner Baumann (werner.baumann@onlinehome.de)
* Add gnulib module alignof * Add gnulib module alignof
cache.c: cache.c:

View File

@ -1903,16 +1903,31 @@ parse_line(char *line, int parmc, char *parmv[])
|| *p == '\r' || *p == '\v') { || *p == '\r' || *p == '\v') {
state = END; state = END;
} else if (*p == '\"') { } else if (*p == '\"') {
state = PARM_QUO; if (parm_no < parmc) {
parmv[parm_no] = pos;
state = PARM_QUO;
} else {
return -1;
}
} else if (*p == '\\') { } else if (*p == '\\') {
if (parm_no < parmc) {
parmv[parm_no] = pos;
state = PARM_ESC;
} else {
return -1;
}
state = PARM_ESC; state = PARM_ESC;
} else if (isspace(*p)) { } else if (isspace(*p)) {
; ;
} else { } else {
*pos++ = *p; if (parm_no < parmc) {
state = PARM; parmv[parm_no] = pos;
*pos++ = *p;
state = PARM;
} else {
return -1;
}
} }
if (parm_no >= parmc) return -1;
break; break;
case SPACE_EXP: case SPACE_EXP:
if (*p == ' ' || *p == '\t') { if (*p == ' ' || *p == '\t') {
@ -1931,7 +1946,7 @@ parse_line(char *line, int parmc, char *parmv[])
state = PARM_ESC; state = PARM_ESC;
} else if (*p == ' ' || *p == '\t') { } else if (*p == ' ' || *p == '\t') {
*pos++ = '\0'; *pos++ = '\0';
parmv[++parm_no] = pos; parm_no++;
state = SPACE; state = SPACE;
} else if (isspace(*p) || *p == '\0' || *p == '#') { } else if (isspace(*p) || *p == '\0' || *p == '#') {
*pos = '\0'; *pos = '\0';
@ -1955,7 +1970,7 @@ parse_line(char *line, int parmc, char *parmv[])
state = PARM_QUO_ESC; state = PARM_QUO_ESC;
} else if (*p == '\"') { } else if (*p == '\"') {
*pos++ = '\0'; *pos++ = '\0';
parmv[++parm_no] = pos; parm_no++;
state = SPACE_EXP; state = SPACE_EXP;
} else if (*p == '\0' || *p == '\f' || *p == '\n' } else if (*p == '\0' || *p == '\f' || *p == '\n'
|| *p == '\r' || *p == '\v') { || *p == '\r' || *p == '\v') {