diff options
author | maya <maya@pkgsrc.org> | 2018-01-14 15:29:38 +0000 |
---|---|---|
committer | maya <maya@pkgsrc.org> | 2018-01-14 15:29:38 +0000 |
commit | 13b5f211bcdcd88bb5787fb21042e6f9d68ca7aa (patch) | |
tree | 83c3882da0f35b8efaa6d09c744db7efb2d6bb23 /security/sudo/patches | |
parent | 3de9c508fd927d90f453e378deda1271d40ffa51 (diff) | |
download | pkgsrc-13b5f211bcdcd88bb5787fb21042e6f9d68ca7aa.tar.gz |
sudo: avoid segfault if hostname is empty
from andrew hall in pr pkg/52923
PKGREVISION++
Diffstat (limited to 'security/sudo/patches')
-rw-r--r-- | security/sudo/patches/patch-lib_util_gethostname.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/security/sudo/patches/patch-lib_util_gethostname.c b/security/sudo/patches/patch-lib_util_gethostname.c new file mode 100644 index 00000000000..0ededb0a835 --- /dev/null +++ b/security/sudo/patches/patch-lib_util_gethostname.c @@ -0,0 +1,16 @@ +$NetBSD: patch-lib_util_gethostname.c,v 1.1 2018/01/14 15:29:38 maya Exp $ + +Avoid segfault if hostname is not set +(upstream commit) + +--- lib/util/gethostname.c.orig 2017-01-14 04:30:15.000000000 +0000 ++++ lib/util/gethostname.c +@@ -42,7 +42,7 @@ sudo_gethostname_v1(void) + + hname = malloc(host_name_max + 1); + if (hname != NULL) { +- if (gethostname(hname, host_name_max + 1) == 0) { ++ if (gethostname(hname, host_name_max + 1) == 0 && *hname != '\0') { + /* Old gethostname() may not NUL-terminate if there is no room. */ + hname[host_name_max] = '\0'; + } else { |