summaryrefslogtreecommitdiff
path: root/security/priv
diff options
context:
space:
mode:
authorsimonb <simonb@pkgsrc.org>2003-07-26 13:27:05 +0000
committersimonb <simonb@pkgsrc.org>2003-07-26 13:27:05 +0000
commit738a46011eb4dc3f2ca7774b280edd6801956107 (patch)
treec02cd7e4909cebfe75b6f29925bea8ce96f0bacd /security/priv
parent55adee4c2f2eae13de0206e734dda7766d510cef (diff)
downloadpkgsrc-738a46011eb4dc3f2ca7774b280edd6801956107.tar.gz
Avoid null-pointer dereference if getpwuid(getuid()) fails.
Diffstat (limited to 'security/priv')
-rw-r--r--security/priv/distinfo3
-rw-r--r--security/priv/patches/patch-aa17
2 files changed, 19 insertions, 1 deletions
diff --git a/security/priv/distinfo b/security/priv/distinfo
index 51126102f4f..69dcee1fae7 100644
--- a/security/priv/distinfo
+++ b/security/priv/distinfo
@@ -1,4 +1,5 @@
-$NetBSD: distinfo,v 1.2 2001/04/19 15:40:37 agc Exp $
+$NetBSD: distinfo,v 1.3 2003/07/26 13:27:05 simonb Exp $
SHA1 (priv-1.0-beta.tar.gz) = 0df065a2d60408d600ec227bda4cea4145e540ee
Size (priv-1.0-beta.tar.gz) = 33877 bytes
+SHA1 (patch-aa) = 5a2f15d6ccd0b8d440912cb2e98b8537d2f70b19
diff --git a/security/priv/patches/patch-aa b/security/priv/patches/patch-aa
new file mode 100644
index 00000000000..4e527c62e8e
--- /dev/null
+++ b/security/priv/patches/patch-aa
@@ -0,0 +1,17 @@
+$NetBSD: patch-aa,v 1.1 2003/07/26 13:27:05 simonb Exp $
+
+--- priv.c.orig 1997-07-08 16:19:06.000000000 +1000
++++ priv.c
+@@ -112,6 +112,12 @@ main(int argc, char **argv, char **envp)
+ }
+
+ pw = getpwuid(getuid());
++ if (pw == NULL) {
++ syslog(LOG_NOTICE, "%s: can't fetch password entry for uid %d",
++ myname, getuid());
++ errx(EXIT_VAL, "can't fetch password entry for uid %d",
++ getuid());
++ }
+ myname = xstrdup(pw->pw_name); /* copy so we can use getpw* later */
+ strcpy(myfullname, pw->pw_name);
+ if ((logname = getlogin()) != NULL && strcmp(logname, myname)) {