diff options
author | ssouhlal <ssouhlal@FreeBSD.org> | 2005-01-25 14:37:43 +0000 |
---|---|---|
committer | ssouhlal <ssouhlal@FreeBSD.org> | 2005-01-25 14:37:43 +0000 |
commit | cae4e5e935dc647d2c45ca36a3b60481979768d3 (patch) | |
tree | d488101d2766c2c385be33571add2cf7435e797e /sbin | |
parent | 0b08736243310e16c905e71910a1169f221f2ac8 (diff) | |
download | FreeBSD-src-cae4e5e935dc647d2c45ca36a3b60481979768d3.zip FreeBSD-src-cae4e5e935dc647d2c45ca36a3b60481979768d3.tar.gz |
Get rid of a NULL dereference when oid is too long.
Reviewed by: keramida
Approved by: grehan (mentor)
MFC after: 1 week
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/sysctl/sysctl.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index e3eca80..3fcd24e 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'; |