diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2002-08-20 18:36:25 +0000 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2002-08-20 18:36:25 +0000 |
commit | 0a4f7542da24b870c3d18bedfcbd4c87aa7ebcd3 (patch) | |
tree | 58843c57ff628b1e59ebc93167fe87e22ef71938 /monitor.c | |
parent | d730b780716d3955066f9fcc89aa377b31079cff (diff) |
- millert@cvs.openbsd.org 2002/08/02 14:43:15
[monitor.c monitor_mm.c]
Change mm_zalloc() sanity checks to be more in line with what
we do in calloc() and add a check to monitor_mm.c.
OK provos@ and markus@
Diffstat (limited to 'monitor.c')
-rw-r--r-- | monitor.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -25,7 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "includes.h" | 27 | #include "includes.h" |
28 | RCSID("$OpenBSD: monitor.c,v 1.22 2002/07/22 17:32:56 stevesk Exp $"); | 28 | RCSID("$OpenBSD: monitor.c,v 1.23 2002/08/02 14:43:15 millert Exp $"); |
29 | 29 | ||
30 | #include <openssl/dh.h> | 30 | #include <openssl/dh.h> |
31 | 31 | ||
@@ -1454,10 +1454,10 @@ mm_get_keystate(struct monitor *pmonitor) | |||
1454 | void * | 1454 | void * |
1455 | mm_zalloc(struct mm_master *mm, u_int ncount, u_int size) | 1455 | mm_zalloc(struct mm_master *mm, u_int ncount, u_int size) |
1456 | { | 1456 | { |
1457 | int len = size * ncount; | 1457 | size_t len = size * ncount; |
1458 | void *address; | 1458 | void *address; |
1459 | 1459 | ||
1460 | if (len <= 0 || size > 65535 || ncount > 65535) | 1460 | if (len == 0 || ncount > SIZE_T_MAX / size) |
1461 | fatal("%s: mm_zalloc(%u, %u)", __func__, ncount, size); | 1461 | fatal("%s: mm_zalloc(%u, %u)", __func__, ncount, size); |
1462 | 1462 | ||
1463 | address = mm_malloc(mm, len); | 1463 | address = mm_malloc(mm, len); |