diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2013-10-31 21:53:17 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2013-10-31 21:53:17 +0000 |
commit | 37f1587b674b2cff15ae20dab64a48d451de1092 (patch) | |
tree | ef9c20d12f15fcf5fe887f8805985c6498c85bb5 | |
parent | 1755f213a8f42f118b38213e4cddd61e1c2444a4 (diff) |
Initialize sun_len, pointed out by deraadt@.
While there also check length of socket path, more relevant now since
an alternative socket can be specified.
OK benno@
-rw-r--r-- | usr.sbin/slowcgi/slowcgi.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.sbin/slowcgi/slowcgi.c b/usr.sbin/slowcgi/slowcgi.c index 539b6108ccf..9b5086802f2 100644 --- a/usr.sbin/slowcgi/slowcgi.c +++ b/usr.sbin/slowcgi/slowcgi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: slowcgi.c,v 1.25 2013/10/29 17:59:47 florian Exp $ */ +/* $OpenBSD: slowcgi.c,v 1.26 2013/10/31 21:53:16 florian Exp $ */ /* * Copyright (c) 2013 David Gwynne <dlg@openbsd.org> * Copyright (c) 2013 Florian Obser <florian@openbsd.org> @@ -337,6 +337,7 @@ slowcgi_listen(char *path, gid_t gid) { struct listener *l = NULL; struct sockaddr_un sun; + size_t len; mode_t old_umask, mode; int fd; @@ -346,7 +347,10 @@ slowcgi_listen(char *path, gid_t gid) bzero(&sun, sizeof(sun)); sun.sun_family = AF_UNIX; - strlcpy(sun.sun_path, path, sizeof(sun.sun_path)); + len = strlcpy(sun.sun_path, path, sizeof(sun.sun_path)); + if (len >= sizeof(sun.sun_path)) + lerrx(1, "socket path to long"); + sun.sun_len = len; if (unlink(path) == -1) if (errno != ENOENT) |