]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] fix off-by-one in path length in destroy_uxst_socket()
authorWilly Tarreau <w@1wt.eu>
Thu, 18 Oct 2007 14:15:52 +0000 (16:15 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 18 Oct 2007 14:15:52 +0000 (16:15 +0200)
An off-by-one error was left in the computation of the unix socket path.

src/proto_uxst.c

index d8c0a9090ebb65ee674839b25930d339b0d6f6bf..24c435ff6281b00dbb59cca296907b3a3301b2bb 100644 (file)
@@ -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