summaryrefslogtreecommitdiffstats
path: root/lib/libpcap/pcap.c
diff options
context:
space:
mode:
authorlteo <lteo@openbsd.org>2014-06-26 04:03:33 +0000
committerlteo <lteo@openbsd.org>2014-06-26 04:03:33 +0000
commitb8f389f962b608e4f0bb70079cf589ea15ecd8ef (patch)
tree7cf5919376b0a7b1aee3e1064c724cb4460cae87 /lib/libpcap/pcap.c
parentDocument that VSCSI_I2T is a non-blocking operation and can be (diff)
downloadwireguard-openbsd-b8f389f962b608e4f0bb70079cf589ea15ecd8ef.tar.xz
wireguard-openbsd-b8f389f962b608e4f0bb70079cf589ea15ecd8ef.zip
Convert several calloc calls to reallocarray. These calloc calls were
originally malloc(n * m) calls (without memset/bzero) in the past. ok deraadt@ tedu@
Diffstat (limited to 'lib/libpcap/pcap.c')
-rw-r--r--lib/libpcap/pcap.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libpcap/pcap.c b/lib/libpcap/pcap.c
index 9403efa340b..6757e769ab0 100644
--- a/lib/libpcap/pcap.c
+++ b/lib/libpcap/pcap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcap.c,v 1.14 2014/03/14 03:44:13 lteo Exp $ */
+/* $OpenBSD: pcap.c,v 1.15 2014/06/26 04:03:33 lteo Exp $ */
/*
* Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998
@@ -265,7 +265,8 @@ pcap_list_datalinks(pcap_t *p, int **dlt_buffer)
**dlt_buffer = p->linktype;
return (1);
} else {
- *dlt_buffer = (int*)calloc(sizeof(**dlt_buffer), p->dlt_count);
+ *dlt_buffer = reallocarray(NULL, sizeof(**dlt_buffer),
+ p->dlt_count);
if (*dlt_buffer == NULL) {
(void)snprintf(p->errbuf, sizeof(p->errbuf),
"malloc: %s", pcap_strerror(errno));