summaryrefslogtreecommitdiff
path: root/security/sudo/patches
diff options
context:
space:
mode:
authormaya <maya@pkgsrc.org>2018-01-14 15:29:38 +0000
committermaya <maya@pkgsrc.org>2018-01-14 15:29:38 +0000
commit13b5f211bcdcd88bb5787fb21042e6f9d68ca7aa (patch)
tree83c3882da0f35b8efaa6d09c744db7efb2d6bb23 /security/sudo/patches
parent3de9c508fd927d90f453e378deda1271d40ffa51 (diff)
downloadpkgsrc-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.c16
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 {