aboutsummaryrefslogtreecommitdiffstats
path: root/slowcgi.c
diff options
context:
space:
mode:
authorflorian2013-10-31 21:53:16 +0000
committerWynn Wolf Arbor2020-05-24 12:33:55 +0200
commitce47d1ea7850fa77759c01e558eb75b7db41aab6 (patch)
tree2a180ef3710325026bc73bb364e69c21acb1f94b /slowcgi.c
parent31d323c3f90e5d5665f43a76e7497bfb36b5cba7 (diff)
downloadslowcgi-ce47d1ea7850fa77759c01e558eb75b7db41aab6.tar.gz
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@
Diffstat (limited to 'slowcgi.c')
-rw-r--r--slowcgi.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/slowcgi.c b/slowcgi.c
index 539b610..9b50868 100644
--- a/slowcgi.c
+++ b/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)