Buffer overflow fix.
This commit is contained in:
parent
057021df0d
commit
030e3a79cb
2 changed files with 2 additions and 2 deletions
|
@ -254,7 +254,7 @@ server_connect(void)
|
||||||
die("Cannot create socket: %m");
|
die("Cannot create socket: %m");
|
||||||
bzero(&sa, sizeof(sa));
|
bzero(&sa, sizeof(sa));
|
||||||
sa.sun_family = AF_UNIX;
|
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)
|
if (connect(server_fd, (struct sockaddr *) &sa, SUN_LEN(&sa)) < 0)
|
||||||
die("Unable to connect to server control socket (%s): %m", server_path);
|
die("Unable to connect to server control socket (%s): %m", server_path);
|
||||||
if (fcntl(server_fd, F_SETFL, O_NONBLOCK) < 0)
|
if (fcntl(server_fd, F_SETFL, O_NONBLOCK) < 0)
|
||||||
|
|
|
@ -866,7 +866,7 @@ sk_open_unix(sock *s, char *name)
|
||||||
goto bad;
|
goto bad;
|
||||||
unlink(name);
|
unlink(name);
|
||||||
sa.sun_family = AF_UNIX;
|
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)
|
if (bind(fd, (struct sockaddr *) &sa, SUN_LEN(&sa)) < 0)
|
||||||
ERR("bind");
|
ERR("bind");
|
||||||
if (listen(fd, 8))
|
if (listen(fd, 8))
|
||||||
|
|
Loading…
Reference in a new issue