summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2002-06-26 13:20:58 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2002-06-26 13:20:58 +0000
commit448ca3852abdb01d2c3fad395b77839a90de589e (patch)
tree66f79ad175eed7b9710176e3549477bcd20639bd
parent146124c8cf09048c8662edfe895169a8f48a94f8 (diff)
be careful in mm_zalloc
-rw-r--r--usr.bin/ssh/monitor.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/ssh/monitor.c b/usr.bin/ssh/monitor.c
index 317da924bb4..8d23f780c1a 100644
--- a/usr.bin/ssh/monitor.c
+++ b/usr.bin/ssh/monitor.c
@@ -25,7 +25,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: monitor.c,v 1.17 2002/06/22 23:09:51 stevesk Exp $");
+RCSID("$OpenBSD: monitor.c,v 1.18 2002/06/26 13:20:57 deraadt Exp $");
#include <openssl/dh.h>
@@ -1418,9 +1418,13 @@ mm_get_keystate(struct monitor *pmonitor)
void *
mm_zalloc(struct mm_master *mm, u_int ncount, u_int size)
{
+ int len = size * ncount;
void *address;
- address = mm_malloc(mm, size * ncount);
+ if (len <= 0)
+ fatal("%s: mm_zalloc(%u, %u)", __func__, ncount, size);
+
+ address = mm_malloc(mm, len);
return (address);
}