1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

libctdb: Ensure 0-termination of sun_path

Rusty, please check!

Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 955f67a02026b157440d2ae87ead193773331e75)
This commit is contained in:
Volker Lendecke 2011-08-18 14:47:09 +02:00 committed by Michael Adam
parent b4fd8024b5
commit 8638b5f5d2

View 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;