From: phk Date: Sun, 15 Jul 2007 11:25:27 +0000 (+0000) Subject: From the "What has the world come to ?" department: X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b4a056ca6bf3d137639a2c1e55bfb9fc54984a20;p=varnish 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: svn+ssh://projects.linpro.no/svn/varnish/trunk@1705 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/lib/libvarnish/cli_common.c b/varnish-cache/lib/libvarnish/cli_common.c index 756f3fd8..1e17b5b6 100644 --- a/varnish-cache/lib/libvarnish/cli_common.c +++ b/varnish-cache/lib/libvarnish/cli_common.c @@ -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)