summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/getgrent.c
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2015-02-07 19:51:34 +0000
committerpfg <pfg@FreeBSD.org>2015-02-07 19:51:34 +0000
commit9ad953310cd830b0996c3b21207c894538f5b3e1 (patch)
treea9b2facb65624e9a2a39edfabc73aca2b1784cf2 /lib/libc/gen/getgrent.c
parent3e318877fe0192b9c3bbe1d7cdc1ef1586b27186 (diff)
downloadFreeBSD-src-9ad953310cd830b0996c3b21207c894538f5b3e1.zip
FreeBSD-src-9ad953310cd830b0996c3b21207c894538f5b3e1.tar.gz
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
Diffstat (limited to 'lib/libc/gen/getgrent.c')
-rw-r--r--lib/libc/gen/getgrent.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/gen/getgrent.c b/lib/libc/gen/getgrent.c
index f9480c3..caa5ad5 100644
--- a/lib/libc/gen/getgrent.c
+++ b/lib/libc/gen/getgrent.c
@@ -896,7 +896,7 @@ files_group(void *retval, void *mdata, va_list ap)
break;
pos = ftello(st->fp);
}
- if (!stayopen && st->fp != NULL) {
+ if (st->fp != NULL && !stayopen) {
fclose(st->fp);
st->fp = NULL;
}
OpenPOWER on IntegriCloud