X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/d9d006d5c2265a2e7f177c776c5edb51f21cbc80..c524da73c079265e1fb0c8c9d24f0be1a6b910f5:/proxy.c diff --git a/proxy.c b/proxy.c index d970b2bf..dd5c428c 100644 --- a/proxy.c +++ b/proxy.c @@ -590,8 +590,14 @@ int proxy_http_negotiate (Proxy_Socket p, int change) /* get the status line */ len = bufchain_size(&p->pending_input_data); assert(len > 0); /* or we wouldn't be here */ - data = snewn(len, char); + data = snewn(len+1, char); bufchain_fetch(&p->pending_input_data, data, len); + /* + * We must NUL-terminate this data, because Windows + * sscanf appears to require a NUL at the end of the + * string because it strlens it _first_. Sigh. + */ + data[len] = '\0'; eol = get_line_end(data, len); if (eol < 0) {