Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-3]: src/lib/libcompat/4.4 Pull up revision 1.8 (requested by luke...



details:   https://anonhg.NetBSD.org/src/rev/e9b4a25781f9
branches:  netbsd-3
changeset: 576523:e9b4a25781f9
user:      tron <tron%NetBSD.org@localhost>
date:      Sat Jul 09 22:53:06 2005 +0000

description:
Pull up revision 1.8 (requested by lukem in ticket #535):
getpw*_r() may return 0 and set pwd==NULL

diffstat:

 lib/libcompat/4.4/cuserid.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (22 lines):

diff -r 876e63012d85 -r e9b4a25781f9 lib/libcompat/4.4/cuserid.c
--- a/lib/libcompat/4.4/cuserid.c       Sat Jul 09 22:52:32 2005 +0000
+++ b/lib/libcompat/4.4/cuserid.c       Sat Jul 09 22:53:06 2005 +0000
@@ -32,7 +32,7 @@
 #if 0
 static char sccsid[] = "@(#)cuserid.c  8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: cuserid.c,v 1.6.6.1 2005/07/09 22:52:32 tron Exp $");
+__RCSID("$NetBSD: cuserid.c,v 1.6.6.2 2005/07/09 22:53:06 tron Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -50,7 +50,8 @@
 
        /* s may be NULL */
 
-       if (getpwuid_r(geteuid(), &pwres, pwbuf, sizeof(pwbuf), &pw) != 0) {
+       if (getpwuid_r(geteuid(), &pwres, pwbuf, sizeof(pwbuf), &pw) != 0
+           || pw == NULL) {
                if (s != NULL)
                        *s = '\0';
                return s;



Home | Main Index | Thread Index | Old Index