diff options
author | florian | 2013-10-31 21:53:16 +0000 |
---|---|---|
committer | Wynn Wolf Arbor | 2020-05-24 12:33:55 +0200 |
commit | ce47d1ea7850fa77759c01e558eb75b7db41aab6 (patch) | |
tree | 2a180ef3710325026bc73bb364e69c21acb1f94b /slowcgi.c | |
parent | 31d323c3f90e5d5665f43a76e7497bfb36b5cba7 (diff) | |
download | slowcgi-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 '')
-rw-r--r-- | slowcgi.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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) |