summaryrefslogtreecommitdiff
path: root/usr/src/lib/nsswitch/files/common/getexecattr.c
diff options
context:
space:
mode:
authorCasper H.S. Dik <Casper.Dik@Sun.COM>2010-04-29 14:06:03 +0200
committerCasper H.S. Dik <Casper.Dik@Sun.COM>2010-04-29 14:06:03 +0200
commitb86d8771495d5dc539b1521b70aa664827db0995 (patch)
treedeca390d7c843f70b9a1c1cf060b6d170a664770 /usr/src/lib/nsswitch/files/common/getexecattr.c
parent00f1c25a65b1cfd93d859ba8bd8872cd7f276c86 (diff)
downloadillumos-gate-b86d8771495d5dc539b1521b70aa664827db0995.tar.gz
6886398 exec_attr lookups crash if /etc/security/exec_attr has mtime of 0
Diffstat (limited to 'usr/src/lib/nsswitch/files/common/getexecattr.c')
-rw-r--r--usr/src/lib/nsswitch/files/common/getexecattr.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr/src/lib/nsswitch/files/common/getexecattr.c b/usr/src/lib/nsswitch/files/common/getexecattr.c
index d4993a98e1..c0b47ea419 100644
--- a/usr/src/lib/nsswitch/files/common/getexecattr.c
+++ b/usr/src/lib/nsswitch/files/common/getexecattr.c
@@ -19,8 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
*/
#include <stdlib.h>
@@ -133,9 +132,11 @@ _exec_files_XY_all(files_backend_ptr_t be,
f_size = f_stat.st_size;
f_time = f_stat.st_mtime;
- while (f_time > read_time) {
+ while (f_time > read_time || f_buf == NULL) {
/*
- * file has been modified since we last read it.
+ * file has been modified since we last read it
+ * or we never read it or memory allocation
+ * failed before.
* read it into the buffer with rw lock.
*/
(void) rw_unlock(&exec_lock);