Coveriry CID 509: Avoid NULL pointer deref.
This commit is contained in:
parent
854b420cd9
commit
dfd5a33604
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: getcap.c,v 1.43 2006/03/19 02:12:09 christos Exp $ */
|
/* $NetBSD: getcap.c,v 1.44 2006/03/19 02:25:12 christos Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1992, 1993
|
* Copyright (c) 1992, 1993
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)getcap.c 8.3 (Berkeley) 3/25/94";
|
static char sccsid[] = "@(#)getcap.c 8.3 (Berkeley) 3/25/94";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: getcap.c,v 1.43 2006/03/19 02:12:09 christos Exp $");
|
__RCSID("$NetBSD: getcap.c,v 1.44 2006/03/19 02:25:12 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* LIBC_SCCS and not lint */
|
#endif /* LIBC_SCCS and not lint */
|
||||||
|
|
||||||
|
@ -785,7 +785,9 @@ cgetnext(char **bp, const char * const *db_array)
|
||||||
line = toprec;
|
line = toprec;
|
||||||
} else {
|
} else {
|
||||||
line = fgetln(pfp, &len);
|
line = fgetln(pfp, &len);
|
||||||
if (line == NULL && pfp) {
|
if (line == NULL) {
|
||||||
|
if (pfp == NULL)
|
||||||
|
return -1;
|
||||||
if (ferror(pfp)) {
|
if (ferror(pfp)) {
|
||||||
(void)cgetclose();
|
(void)cgetclose();
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
Loading…
Reference in New Issue