summaryrefslogtreecommitdiff
path: root/lib/libevent
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2007-09-02 15:19:41 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2007-09-02 15:19:41 +0000
commit6ebd04219f0d749c87a763e8afb578dfcd5223cc (patch)
treebb0f29e0a3791fff88551c93f5d4ba7113bdba43 /lib/libevent
parentbe524287dc216d876f995eddcaf32762c702c6e9 (diff)
use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg
Diffstat (limited to 'lib/libevent')
-rw-r--r--lib/libevent/kqueue.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libevent/kqueue.c b/lib/libevent/kqueue.c
index c85334c29aa..89eb3356ad1 100644
--- a/lib/libevent/kqueue.c
+++ b/lib/libevent/kqueue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kqueue.c,v 1.22 2007/03/19 15:12:49 millert Exp $ */
+/* $OpenBSD: kqueue.c,v 1.23 2007/09/02 15:19:18 deraadt Exp $ */
/*
* Copyright 2000-2002 Niels Provos <provos@citi.umich.edu>
@@ -111,12 +111,12 @@ kq_init(void)
kqueueop->kq = kq;
/* Initalize fields */
- kqueueop->changes = malloc(NEVENT * sizeof(struct kevent));
+ kqueueop->changes = calloc(NEVENT, sizeof(struct kevent));
if (kqueueop->changes == NULL) {
free (kqueueop);
return (NULL);
}
- kqueueop->events = malloc(NEVENT * sizeof(struct kevent));
+ kqueueop->events = calloc(NEVENT, sizeof(struct kevent));
if (kqueueop->events == NULL) {
free (kqueueop->changes);
free (kqueueop);