Debian Codegraph @

debian/patches/dbminit_fclose_null

raw
1 prevent fclose(NULL) on dbminit() failure
2
3 When fed a bad database, dbminit() could call fclose() on a NULL pointer.
4 Bug reported by the Mayhem team at CMU.
5
6 --- a/dbz/dbz.c
7 +++ b/dbz/dbz.c
8 @@ -873,7 +873,8 @@ char *name;
9 /* pick up configuration */
10 if (getconf(dirf, pagf, &conf) < 0) {
11 DEBUG(("dbminit: getconf failure\n"));
12 - (void) fclose(basef);
13 + if (basef != NULL)
14 + (void) fclose(basef);
15 (void) fclose(pagf);
16 (void) fclose(dirf);
17 free((POINTER)pagfname);