From: phk Date: Tue, 4 Jul 2006 14:45:01 +0000 (+0000) Subject: Make room for protective terminating NUL X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e12ce1f963dccaaa137e452de31864ed0826feba;p=varnish Make room for protective terminating NUL git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@300 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache_http.c b/varnish-cache/bin/varnishd/cache_http.c index d669bfe0..9b8ba126 100644 --- a/varnish-cache/bin/varnishd/cache_http.c +++ b/varnish-cache/bin/varnishd/cache_http.c @@ -305,11 +305,13 @@ http_read_f(int fd, short event, void *arg) { struct http *hp = arg; char *p; + unsigned l; int i; - assert(hp->v < hp->e); + l = hp->e - hp->v; + assert(l > 1); errno = 0; - i = read(fd, hp->v, hp->e - hp->v); + i = read(fd, hp->v, l - 1); if (i <= 0) { if (hp->v != hp->s) VSL(SLT_HttpError, fd,