libctdb: Ensure 0-termination of sun_path
authorVolker Lendecke <vl@samba.org>
Thu, 18 Aug 2011 12:47:09 +0000 (14:47 +0200)
committerMichael Adam <obnox@samba.org>
Mon, 22 Aug 2011 15:11:06 +0000 (17:11 +0200)
Rusty, please check!

Signed-off-by: Michael Adam <obnox@samba.org>
libctdb/ctdb.c

index 141f42f63d9cd747324d84f81ca1f56b38858a54..8ede2a274b06667969beced3be7a2304c631b3e6 100644 (file)
@@ -166,7 +166,7 @@ struct ctdb_connection *ctdb_connect(const char *addr,
        sun.sun_family = AF_UNIX;
        if (!addr)
                addr = CTDB_PATH;
-       strncpy(sun.sun_path, addr, sizeof(sun.sun_path));
+       strncpy(sun.sun_path, addr, sizeof(sun.sun_path)-1);
        ctdb->fd = socket(AF_UNIX, SOCK_STREAM, 0);
        if (ctdb->fd < 0)
                goto free_fail;