From 030e3a79cb9376fa85597fdb8243299cd843ca3a Mon Sep 17 00:00:00 2001 From: Ondrej Filip Date: Mon, 25 Aug 2008 11:57:46 +0000 Subject: Buffer overflow fix. --- client/client.c | 2 +- sysdep/unix/io.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/client.c b/client/client.c index d65ea06..828b9de 100644 --- a/client/client.c +++ b/client/client.c @@ -254,7 +254,7 @@ server_connect(void) die("Cannot create socket: %m"); bzero(&sa, sizeof(sa)); sa.sun_family = AF_UNIX; - strcpy(sa.sun_path, server_path); + strncpy(sa.sun_path, server_path, sizeof(sa.sun_path)); if (connect(server_fd, (struct sockaddr *) &sa, SUN_LEN(&sa)) < 0) die("Unable to connect to server control socket (%s): %m", server_path); if (fcntl(server_fd, F_SETFL, O_NONBLOCK) < 0) diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c index 7dcca21..338edf4 100644 --- a/sysdep/unix/io.c +++ b/sysdep/unix/io.c @@ -866,7 +866,7 @@ sk_open_unix(sock *s, char *name) goto bad; unlink(name); sa.sun_family = AF_UNIX; - strcpy(sa.sun_path, name); + strncpy(sa.sun_path, name, sizeof(sa.sun_path)); if (bind(fd, (struct sockaddr *) &sa, SUN_LEN(&sa)) < 0) ERR("bind"); if (listen(fd, 8)) -- cgit v1.2.3