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';