Commit 04f1535b authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

From the "What has the world come to ?" department:

It used to be that sscanf(3) would walk along the proffered string
and do what the format string was told, and as long as the format
terminated before the input string, the NUL termination was not
relevant.

Sometime in the last 20 years, sscanf started doing a strlen on the
passed argument changing this behaviour.

Give sscanf the NUL it wants.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@1705 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent b776a5bb
......@@ -154,6 +154,7 @@ cli_readres(int fd, unsigned *status, char **ptr, double tmo)
assert(i == CLI_LINE0_LEN);
assert(res[3] == ' ');
assert(res[CLI_LINE0_LEN - 1] == '\n');
res[CLI_LINE0_LEN - 1] = '\0';
j = sscanf(res, "%u %u\n", &u, &v);
assert(j == 2);
if (status != NULL)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment