Coverity CID 2764: Avoid null reference

This commit is contained in:
christos 2006-03-26 23:10:26 +00:00
parent 3c0ef79b7f
commit 48ce3c5d75
1 changed files with 6 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysctl.c,v 1.112 2006/03/22 02:25:44 christos Exp $ */
/* $NetBSD: sysctl.c,v 1.113 2006/03/26 23:10:26 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -72,7 +72,7 @@ __COPYRIGHT(
#if 0
static char sccsid[] = "@(#)sysctl.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: sysctl.c,v 1.112 2006/03/22 02:25:44 christos Exp $");
__RCSID("$NetBSD: sysctl.c,v 1.113 2006/03/26 23:10:26 christos Exp $");
#endif
#endif /* not lint */
@ -1016,6 +1016,10 @@ parse_create(char *l)
EXIT(1);
}
errno = 0;
if (value == NULL) {
sysctlperror("%s: missing value\n", nname);
EXIT(1);
}
addr = (void*)strtoul(value, &t, 0);
if (t == value || *t != '\0' || errno != 0) {
sysctlperror(