summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2006-01-16 22:45:58 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2006-01-16 22:45:58 +0000
commitb7ffe7e87ee21e1dff5302e470d7b9490c931053 (patch)
treea11a24328b49150331a3d05b4351b610ddd5131b
parent8c9b2c9b4b083aa0ee5de9b0e2b4821ec02b3b51 (diff)
malloc fix for bpf interface array allocation (from freebsd). use
calloc instead of the proposed fix with additional parentheses. ok moritz@ millert@
-rw-r--r--lib/libpcap/pcap-bpf.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/libpcap/pcap-bpf.c b/lib/libpcap/pcap-bpf.c
index 6a9ef0c885b..60b5cc7b140 100644
--- a/lib/libpcap/pcap-bpf.c
+++ b/lib/libpcap/pcap-bpf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcap-bpf.c,v 1.18 2006/01/11 07:31:46 jaredy Exp $ */
+/* $OpenBSD: pcap-bpf.c,v 1.19 2006/01/16 22:45:57 reyk Exp $ */
/*
* Copyright (c) 1993, 1994, 1995, 1996, 1998
@@ -278,8 +278,7 @@ pcap_open_live(const char *device, int snaplen, int promisc, int to_ms,
* not fatal; we just don't get to use the feature later.
*/
if (ioctl(fd, BIOCGDLTLIST, (caddr_t)&bdl) == 0) {
- bdl.bfl_list = (u_int *) malloc(sizeof(u_int) *
- bdl.bfl_len + 1);
+ bdl.bfl_list = (u_int *) calloc(bdl.bfl_len + 1, sizeof(u_int));
if (bdl.bfl_list == NULL) {
(void)snprintf(ebuf, PCAP_ERRBUF_SIZE, "malloc: %s",
pcap_strerror(errno));