mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-20 04:37:04 +00:00
BUG/MEDIUM: tools: off-by-one in quote_arg()
This function may write the \0 one char too far in the static array. There is no effect right now as the function has never been used except maybe in code that was never released. Out-of-tree code might possibly be affected though (hence the MEDIUM flag). No backport is needed. Reported-by: Dinko Korunic <dkorunic@reflected.net>
This commit is contained in:
parent
1a53b5ef58
commit
de2dd6b125
@ -1567,7 +1567,7 @@ const char *quote_arg(const char *ptr)
|
||||
if (!ptr || !*ptr)
|
||||
return "end of line";
|
||||
val[0] = '\'';
|
||||
for (i = 1; i < sizeof(val) - 1 && *ptr; i++)
|
||||
for (i = 1; i < sizeof(val) - 2 && *ptr; i++)
|
||||
val[i] = *ptr++;
|
||||
val[i++] = '\'';
|
||||
val[i] = '\0';
|
||||
|
Loading…
Reference in New Issue
Block a user