summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreyk <reyk@openbsd.org>2015-08-21 08:29:06 +0000
committerreyk <reyk@openbsd.org>2015-08-21 08:29:06 +0000
commit882b1c9d43b438dba0b35bdffd040176919f0cf5 (patch)
tree3dfe8e8759311581f4830a8c361e3fee6d90f758
parentThe WebDAV MOVE method was not included in the switch statement (diff)
downloadwireguard-openbsd-882b1c9d43b438dba0b35bdffd040176919f0cf5.tar.xz
wireguard-openbsd-882b1c9d43b438dba0b35bdffd040176919f0cf5.zip
Use reallocarray() instead of malloc() before strvisx().
Found by deraadt@ OK blambert@
-rw-r--r--usr.sbin/snmpd/smi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.sbin/snmpd/smi.c b/usr.sbin/snmpd/smi.c
index e41dd37b19f..0f1bd13c13d 100644
--- a/usr.sbin/snmpd/smi.c
+++ b/usr.sbin/snmpd/smi.c
@@ -514,7 +514,7 @@ smi_print_element(struct ber_element *root)
inet_ntoa(*(struct in_addr *)buf)) == -1)
goto fail;
} else {
- if ((p = malloc(root->be_len * 4 + 1)) == NULL)
+ if ((p = reallocarray(NULL, 4, root->be_len + 1)) == NULL)
goto fail;
strvisx(p, buf, root->be_len, VIS_NL);
if (asprintf(&str, "\"%s\"", p) == -1) {