Coverity CID 2784: Add more checks for value==NULL.

This commit is contained in:
jnemeth 2006-03-30 08:02:40 +00:00
parent 705abf8c8b
commit 7b95c00460
1 changed files with 6 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysctl.c,v 1.114 2006/03/26 23:12:48 christos Exp $ */ /* $NetBSD: sysctl.c,v 1.115 2006/03/30 08:02:40 jnemeth Exp $ */
/*- /*-
* Copyright (c) 2003 The NetBSD Foundation, Inc. * Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -72,7 +72,7 @@ __COPYRIGHT(
#if 0 #if 0
static char sccsid[] = "@(#)sysctl.c 8.1 (Berkeley) 6/6/93"; static char sccsid[] = "@(#)sysctl.c 8.1 (Berkeley) 6/6/93";
#else #else
__RCSID("$NetBSD: sysctl.c,v 1.114 2006/03/26 23:12:48 christos Exp $"); __RCSID("$NetBSD: sysctl.c,v 1.115 2006/03/30 08:02:40 jnemeth Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -1067,6 +1067,10 @@ parse_create(char *l)
} }
} }
else if (strcmp(key, "size") == 0) { else if (strcmp(key, "size") == 0) {
if (value == NULL) {
sysctlperror("%s: missing value\n", nname);
EXIT(1);
}
errno = 0; errno = 0;
/* /*
* yes, i know size_t is not an unsigned long, * yes, i know size_t is not an unsigned long,