From: Willy Tarreau Date: Thu, 18 Oct 2007 14:15:52 +0000 (+0200) Subject: [BUG] fix off-by-one in path length in destroy_uxst_socket() X-Git-Tag: v1.3.13~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=10ae5480527ac964306aa42f25e4394bc6878b36;p=thirdparty%2Fhaproxy.git [BUG] fix off-by-one in path length in destroy_uxst_socket() An off-by-one error was left in the computation of the unix socket path. --- diff --git a/src/proto_uxst.c b/src/proto_uxst.c index d8c0a9090e..24c435ff62 100644 --- a/src/proto_uxst.c +++ b/src/proto_uxst.c @@ -198,7 +198,7 @@ static void destroy_uxst_socket(const char *path) addr.sun_family = AF_UNIX; strncpy(addr.sun_path, path, sizeof(addr.sun_path)); - addr.sun_path[sizeof(addr.sun_path)] = 0; + addr.sun_path[sizeof(addr.sun_path) - 1] = 0; ret = connect(sock, (struct sockaddr *)&addr, sizeof(addr)); if (ret < 0 && errno == ECONNREFUSED) { /* Connect failed: the socket still exists but is not used