diff options
author | 2007-09-02 15:19:07 +0000 | |
---|---|---|
committer | 2007-09-02 15:19:07 +0000 | |
commit | 1ed98fdf61d9dd29369f246109081408082ce54d (patch) | |
tree | ad7631e58c83830d1fc51cbadb9a2da53c1abfb7 /lib/libpcap/pcap.c | |
parent | OpenCVS server init-support with OpenCVS and GNU cvs clients. (diff) | |
download | wireguard-openbsd-1ed98fdf61d9dd29369f246109081408082ce54d.tar.xz wireguard-openbsd-1ed98fdf61d9dd29369f246109081408082ce54d.zip |
use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg
Diffstat (limited to 'lib/libpcap/pcap.c')
-rw-r--r-- | lib/libpcap/pcap.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libpcap/pcap.c b/lib/libpcap/pcap.c index 6c516f39e32..9bf613921c0 100644 --- a/lib/libpcap/pcap.c +++ b/lib/libpcap/pcap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcap.c,v 1.10 2006/03/26 20:58:51 djm Exp $ */ +/* $OpenBSD: pcap.c,v 1.11 2007/09/02 15:19:18 deraadt Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998 @@ -209,7 +209,7 @@ pcap_list_datalinks(pcap_t *p, int **dlt_buffer) **dlt_buffer = p->linktype; return (1); } else { - *dlt_buffer = (int*)malloc(sizeof(**dlt_buffer) * p->dlt_count); + *dlt_buffer = (int*)calloc(sizeof(**dlt_buffer), p->dlt_count); if (*dlt_buffer == NULL) { (void)snprintf(p->errbuf, sizeof(p->errbuf), "malloc: %s", pcap_strerror(errno)); |