diff options
author | 2015-08-21 08:29:06 +0000 | |
---|---|---|
committer | 2015-08-21 08:29:06 +0000 | |
commit | 882b1c9d43b438dba0b35bdffd040176919f0cf5 (patch) | |
tree | 3dfe8e8759311581f4830a8c361e3fee6d90f758 | |
parent | The WebDAV MOVE method was not included in the switch statement (diff) | |
download | wireguard-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.c | 2 |
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) { |