Source-Changes-HG archive

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

[src/trunk]: src/lib/libpam/modules/pam_exec PR/44505: Mark Davies: pam_exec ...



details:   https://anonhg.NetBSD.org/src/rev/2eaf8558961b
branches:  trunk
changeset: 761624:2eaf8558961b
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Feb 03 02:05:59 2011 +0000

description:
PR/44505: Mark Davies: pam_exec fails to realloc enough space, while
there add a volatile variable (From FreeBSD)

diffstat:

 lib/libpam/modules/pam_exec/pam_exec.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r c78620e116d5 -r 2eaf8558961b lib/libpam/modules/pam_exec/pam_exec.c
--- a/lib/libpam/modules/pam_exec/pam_exec.c    Wed Feb 02 23:27:11 2011 +0000
+++ b/lib/libpam/modules/pam_exec/pam_exec.c    Thu Feb 03 02:05:59 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pam_exec.c,v 1.4 2005/02/26 22:45:52 christos Exp $    */
+/*     $NetBSD: pam_exec.c,v 1.5 2011/02/03 02:05:59 christos Exp $    */
 
 /*-
  * Copyright (c) 2001,2003 Networks Associates Technology, Inc.
@@ -38,7 +38,7 @@
 #ifdef __FreeBSD__
 __FBSDID("$FreeBSD: src/lib/libpam/modules/pam_exec/pam_exec.c,v 1.4 2005/02/01 10:37:07 des Exp $");
 #else
-__RCSID("$NetBSD: pam_exec.c,v 1.4 2005/02/26 22:45:52 christos Exp $");
+__RCSID("$NetBSD: pam_exec.c,v 1.5 2011/02/03 02:05:59 christos Exp $");
 #endif
 
 #include <sys/types.h>
@@ -70,8 +70,9 @@
 _pam_exec(pam_handle_t *pamh __unused, int flags __unused,
     int argc, const char *argv[])
 {
-       int childerr, envlen, i, nitems, pam_err, status;
+       int envlen, i, nitems, pam_err, status;
        char **envlist, **tmp;
+       volatile int childerr;
        pid_t pid;
 
        if (argc < 1)
@@ -90,7 +91,7 @@
        for (envlen = 0; envlist[envlen] != NULL; ++envlen)
                /* nothing */ ;
        nitems = sizeof(env_items) / sizeof(*env_items);
-       tmp = realloc(envlist, (envlen + nitems + 1) * sizeof **envlist);
+       tmp = realloc(envlist, (envlen + nitems + 1) * sizeof(*envlist));
        if (tmp == NULL) {
                openpam_free_envlist(envlist);
                return (PAM_BUF_ERR);



Home | Main Index | Thread Index | Old Index