Fixed buffer overflow when p-res==targetlen in function getreqentry
This commit is contained in:
parent
e9408312e1
commit
abec80e6ce
1 changed files with 1 additions and 1 deletions
2
quark.c
2
quark.c
|
@ -363,7 +363,7 @@ getreqentry(char *name, char *target, size_t targetlen, char *breakchars) {
|
||||||
for(p = res; *p && !strchr(breakchars, *p); ++p);
|
for(p = res; *p && !strchr(breakchars, *p); ++p);
|
||||||
if(!*p)
|
if(!*p)
|
||||||
return 1;
|
return 1;
|
||||||
if((size_t)(p - res) > targetlen)
|
if((size_t)(p - res) >= targetlen)
|
||||||
return 1;
|
return 1;
|
||||||
memcpy(target, res, p - res);
|
memcpy(target, res, p - res);
|
||||||
target[p - res] = 0;
|
target[p - res] = 0;
|
||||||
|
|
Loading…
Reference in a new issue