[master] 50bc002 Fix buffer overrun in varnishadm pass function

Martin Blix Grydeland martin at varnish-cache.org
Tue Oct 1 14:48:20 CEST 2013


commit 50bc002998c7040c56bbdbb994bad173e3f97784
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 f356546..982fbc2 100644
--- a/bin/varnishadm/varnishadm.c
+++ b/bin/varnishadm/varnishadm.c
@@ -351,7 +351,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