Source-Changes-HG archive

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

[src/netbsd-1-4]: src/usr.bin/su Pull up revision 1.35:



details:   https://anonhg.NetBSD.org/src/rev/353bd8f3f7a6
branches:  netbsd-1-4
changeset: 469309:353bd8f3f7a6
user:      he <he%NetBSD.org@localhost>
date:      Sun Aug 29 11:25:05 1999 +0000

description:
Pull up revision 1.35:
  Fix memory corruption problem.  (christos)

diffstat:

 usr.bin/su/su.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (48 lines):

diff -r 5aec5e93d036 -r 353bd8f3f7a6 usr.bin/su/su.c
--- a/usr.bin/su/su.c   Sun Aug 29 11:21:02 1999 +0000
+++ b/usr.bin/su/su.c   Sun Aug 29 11:25:05 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: su.c,v 1.33 1999/03/22 03:25:33 abs Exp $      */
+/*     $NetBSD: su.c,v 1.33.2.1 1999/08/29 11:25:05 he Exp $   */
 
 /*
  * Copyright (c) 1988 The Regents of the University of California.
@@ -44,7 +44,7 @@
 #if 0
 static char sccsid[] = "@(#)su.c       8.3 (Berkeley) 4/2/94";*/
 #else
-__RCSID("$NetBSD: su.c,v 1.33 1999/03/22 03:25:33 abs Exp $");
+__RCSID("$NetBSD: su.c,v 1.33.2.1 1999/08/29 11:25:05 he Exp $");
 #endif
 #endif /* not lint */
 
@@ -109,7 +109,7 @@
        uid_t ruid;
        int asme, ch, asthem, fastlogin, prio;
        enum { UNSET, YES, NO } iscsh = UNSET;
-       char *user, *shell, *avshell, *username, *cleanenv[10], **np;
+       char *user, *shell, *avshell, *username, **np;
        char *userpass;
        char shellbuf[MAXPATHLEN], avshellbuf[MAXPATHLEN];
 
@@ -179,7 +179,6 @@
 
        if ((pwd = getpwnam(user)) == NULL)
                errx(1, "unknown login %s", user);
-
        if (ruid
 #ifdef KERBEROS
            && (!use_kerberos || kerberos(username, user, pwd->pw_uid))
@@ -292,8 +291,10 @@
        if (!asme) {
                if (asthem) {
                        p = getenv("TERM");
-                       cleanenv[0] = NULL;
-                       environ = cleanenv;
+                       /* Create an empty environment */
+                       if ((environ = malloc(sizeof(char *))) == NULL)
+                               err(1, "%s", "");
+                       environ[0] = NULL;
                        (void)setenv("PATH", _PATH_DEFPATH, 1);
                        if (p)
                                (void)setenv("TERM", p, 1);



Home | Main Index | Thread Index | Old Index