]> err.no Git - varnish/commitdiff
Make room for protective terminating NUL
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 4 Jul 2006 14:45:01 +0000 (14:45 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 4 Jul 2006 14:45:01 +0000 (14:45 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@300 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_http.c

index d669bfe0fb0014ea7f54a8b355621c6c399cc5d5..9b8ba12645eebf6f85b6a2dc975b8cbee4f9abab 100644 (file)
@@ -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,