svn commit: r278363 - head/lib/libc/gen
Pedro F. Giffuni
pfg at FreeBSD.org
Sat Feb 7 19:51:36 UTC 2015
Author: pfg
Date: Sat Feb 7 19:51:34 2015
New Revision: 278363
URL: https://svnweb.freebsd.org/changeset/base/278363
Log:
Protect uninitialized scalar variable from being accessed
In a couple of cases a variable "stayopen" can be checked
unitialized. This is of no danger as the complementary
condition is false but prevent the access by switching
the checks.
CID: 1018729
CID: 1018732
Modified:
head/lib/libc/gen/getgrent.c
head/lib/libc/gen/getpwent.c
Modified: head/lib/libc/gen/getgrent.c
==============================================================================
--- head/lib/libc/gen/getgrent.c Sat Feb 7 17:53:47 2015 (r278362)
+++ head/lib/libc/gen/getgrent.c Sat Feb 7 19:51:34 2015 (r278363)
@@ -896,7 +896,7 @@ files_group(void *retval, void *mdata, v
break;
pos = ftello(st->fp);
}
- if (!stayopen && st->fp != NULL) {
+ if (st->fp != NULL && !stayopen) {
fclose(st->fp);
st->fp = NULL;
}
Modified: head/lib/libc/gen/getpwent.c
==============================================================================
--- head/lib/libc/gen/getpwent.c Sat Feb 7 17:53:47 2015 (r278362)
+++ head/lib/libc/gen/getpwent.c Sat Feb 7 19:51:34 2015 (r278363)
@@ -921,7 +921,7 @@ files_passwd(void *retval, void *mdata,
errnop);
} while (how == nss_lt_all && !(rv & NS_TERMINATE));
fin:
- if (!stayopen && st->db != NULL) {
+ if (st->db != NULL && !stayopen) {
(void)st->db->close(st->db);
st->db = NULL;
}
More information about the svn-src-all
mailing list