[3.0] 0531578 Fix buffer overrun in varnishadm pass function

Martin Blix Grydeland martin at varnish-cache.org
Wed Oct 2 14:24:10 CEST 2013


commit 0531578def6184919d04ebe171fce98f54f4333c
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Tue Oct 1 14:32:44 2013 +0200

    Fix buffer overrun in varnishadm pass function
    
    Spotted by: Coverity

diff --git a/bin/varnishadm/varnishadm.c b/bin/varnishadm/varnishadm.c
index 0abda8d..005c62f 100644
--- a/bin/varnishadm/varnishadm.c
+++ b/bin/varnishadm/varnishadm.c
@@ -345,7 +345,7 @@ pass(int sock)
 			}
 		}
 		if (fds[1].revents & POLLIN || fds[1].revents & POLLHUP) {
-			n = read(fds[1].fd, buf, sizeof buf);
+			n = read(fds[1].fd, buf, sizeof buf - 1);
 			if (n == 0) {
 				AZ(shutdown(sock, SHUT_WR));
 				fds[1].fd = -1;



More information about the varnish-commit mailing list