Module Name: src
Committed By: tron
Date: Sat Oct 2 10:55:36 UTC 2010
Modified Files:
src/usr.bin/su: su_pam.c
Log Message:
Don't free memory that was succesfully passed to putenv(3) which takes
ownership of the memory.
To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/su/su_pam.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/su/su_pam.c
diff -u src/usr.bin/su/su_pam.c:1.15 src/usr.bin/su/su_pam.c:1.16
--- src/usr.bin/su/su_pam.c:1.15 Mon Jul 21 14:19:26 2008
+++ src/usr.bin/su/su_pam.c Sat Oct 2 10:55:36 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: su_pam.c,v 1.15 2008/07/21 14:19:26 lukem Exp $ */
+/* $NetBSD: su_pam.c,v 1.16 2010/10/02 10:55:36 tron Exp $ */
/*
* Copyright (c) 1988 The Regents of the University of California.
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)su.c 8.3 (Berkeley) 4/2/94";*/
#else
-__RCSID("$NetBSD: su_pam.c,v 1.15 2008/07/21 14:19:26 lukem Exp $");
+__RCSID("$NetBSD: su_pam.c,v 1.16 2010/10/02 10:55:36 tron Exp $");
#endif
#endif /* not lint */
@@ -469,8 +469,8 @@
* how could we get untrusted data here?
*/
for (envitem = pamenv; *envitem; envitem++) {
- (void)putenv(*envitem);
- free(*envitem);
+ if (putenv(*envitem) == -1)
+ free(*envitem);
}
free(pamenv);