From 1d4961c06f6999b6a981862746a8edadcdd85baa Mon Sep 17 00:00:00 2001 From: Suleiman Souhlal Date: Tue, 25 Jan 2005 14:37:43 +0000 Subject: [PATCH] Get rid of a NULL dereference when oid is too long. Reviewed by: keramida Approved by: grehan (mentor) MFC after: 1 week --- sbin/sysctl/sysctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index e3eca8093572..3fcd24eeab91 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -169,7 +169,8 @@ parse(char *string) u_int kind; bufp = buf; - snprintf(buf, BUFSIZ, "%s", string); + if (snprintf(buf, BUFSIZ, "%s", string) >= BUFSIZ) + errx(1, "oid too long: '%s'", string); if ((cp = strchr(string, '=')) != NULL) { *strchr(buf, '=') = '\0'; *cp++ = '\0';