diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2001-09-18 16:38:00 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2001-09-18 16:38:00 +0000 |
commit | 1cbada65ad582816458364ad6cf6697491b461d2 (patch) | |
tree | f19e7b191c1a7e968788cdc7fdfd3123e7232cc2 /usr.bin | |
parent | 1f3d5d0d243ba2ce38d5faf175de2e42b9d2594c (diff) |
check strdup() rval
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/su/su.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/su/su.c b/usr.bin/su/su.c index 59bf7a91608..775d38c890c 100644 --- a/usr.bin/su/su.c +++ b/usr.bin/su/su.c @@ -1,4 +1,4 @@ -/* $OpenBSD: su.c,v 1.41 2001/09/18 04:41:09 millert Exp $ */ +/* $OpenBSD: su.c,v 1.42 2001/09/18 16:37:59 millert Exp $ */ /* * Copyright (c) 1988 The Regents of the University of California. @@ -43,7 +43,7 @@ static const char copyright[] = #if 0 static const char sccsid[] = "from: @(#)su.c 5.26 (Berkeley) 7/6/91"; #else -static const char rcsid[] = "$OpenBSD: su.c,v 1.41 2001/09/18 04:41:09 millert Exp $"; +static const char rcsid[] = "$OpenBSD: su.c,v 1.42 2001/09/18 16:37:59 millert Exp $"; #endif #endif /* not lint */ @@ -159,7 +159,8 @@ main(argc, argv) auth_errx(as, 1, "can't allocate memory"); if (asme) { if (pwd->pw_shell && *pwd->pw_shell) { - shell = strdup(pwd->pw_shell); + if ((shell = strdup(pwd->pw_shell)) == NULL) + auth_errx(as, 1, "can't allocate memory"); } else { shell = _PATH_BSHELL; iscsh = NO; |