summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--monitor.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/monitor.c b/monitor.c
index a91420983..934898392 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: monitor.c,v 1.150 2015/06/22 23:42:16 djm Exp $ */ 1/* $OpenBSD: monitor.c,v 1.151 2015/08/21 23:29:31 deraadt Exp $ */
2/* 2/*
3 * Copyright 2002 Niels Provos <provos@citi.umich.edu> 3 * Copyright 2002 Niels Provos <provos@citi.umich.edu>
4 * Copyright 2002 Markus Friedl <markus@openbsd.org> 4 * Copyright 2002 Markus Friedl <markus@openbsd.org>
@@ -487,15 +487,10 @@ monitor_sync(struct monitor *pmonitor)
487static void * 487static void *
488mm_zalloc(struct mm_master *mm, u_int ncount, u_int size) 488mm_zalloc(struct mm_master *mm, u_int ncount, u_int size)
489{ 489{
490 size_t len = (size_t) size * ncount; 490 if (size == 0 || ncount == 0 || ncount > SIZE_MAX / size)
491 void *address;
492
493 if (len == 0 || ncount > SIZE_MAX / size)
494 fatal("%s: mm_zalloc(%u, %u)", __func__, ncount, size); 491 fatal("%s: mm_zalloc(%u, %u)", __func__, ncount, size);
495 492
496 address = mm_malloc(mm, len); 493 return mm_malloc(mm, size * ncount);
497
498 return (address);
499} 494}
500 495
501static void 496static void