diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | monitor.c | 6 | ||||
-rw-r--r-- | monitor_mm.c | 6 |
3 files changed, 16 insertions, 6 deletions
@@ -1,3 +1,11 @@ | |||
1 | 20020820 | ||
2 | - OpenBSD CVS Sync | ||
3 | - millert@cvs.openbsd.org 2002/08/02 14:43:15 | ||
4 | [monitor.c monitor_mm.c] | ||
5 | Change mm_zalloc() sanity checks to be more in line with what | ||
6 | we do in calloc() and add a check to monitor_mm.c. | ||
7 | OK provos@ and markus@ | ||
8 | |||
1 | 20020813 | 9 | 20020813 |
2 | - (tim) [configure.ac] Display OpenSSL header/library version. | 10 | - (tim) [configure.ac] Display OpenSSL header/library version. |
3 | Patch by dtucker@zip.com.au | 11 | Patch by dtucker@zip.com.au |
@@ -1494,4 +1502,4 @@ | |||
1494 | - (stevesk) entropy.c: typo in debug message | 1502 | - (stevesk) entropy.c: typo in debug message |
1495 | - (djm) ssh-keygen -i needs seeded RNG; report from markus@ | 1503 | - (djm) ssh-keygen -i needs seeded RNG; report from markus@ |
1496 | 1504 | ||
1497 | $Id: ChangeLog,v 1.2414 2002/08/14 01:52:10 tim Exp $ | 1505 | $Id: ChangeLog,v 1.2415 2002/08/20 18:36:25 mouring Exp $ |
@@ -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); |
diff --git a/monitor_mm.c b/monitor_mm.c index fbf57b439..b4a6e40c9 100644 --- a/monitor_mm.c +++ b/monitor_mm.c | |||
@@ -24,7 +24,7 @@ | |||
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "includes.h" | 26 | #include "includes.h" |
27 | RCSID("$OpenBSD: monitor_mm.c,v 1.7 2002/06/28 01:49:31 millert Exp $"); | 27 | RCSID("$OpenBSD: monitor_mm.c,v 1.8 2002/08/02 14:43:15 millert Exp $"); |
28 | 28 | ||
29 | #ifdef HAVE_SYS_MMAN_H | 29 | #ifdef HAVE_SYS_MMAN_H |
30 | #include <sys/mman.h> | 30 | #include <sys/mman.h> |
@@ -167,8 +167,10 @@ mm_malloc(struct mm_master *mm, size_t size) | |||
167 | 167 | ||
168 | if (size == 0) | 168 | if (size == 0) |
169 | fatal("mm_malloc: try to allocate 0 space"); | 169 | fatal("mm_malloc: try to allocate 0 space"); |
170 | if (size > SIZE_T_MAX - MM_MINSIZE + 1) | ||
171 | fatal("mm_malloc: size too big"); | ||
170 | 172 | ||
171 | size = ((size + MM_MINSIZE - 1) / MM_MINSIZE) * MM_MINSIZE; | 173 | size = ((size + (MM_MINSIZE - 1)) / MM_MINSIZE) * MM_MINSIZE; |
172 | 174 | ||
173 | RB_FOREACH(mms, mmtree, &mm->rb_free) { | 175 | RB_FOREACH(mms, mmtree, &mm->rb_free) { |
174 | if (mms->size >= size) | 176 | if (mms->size >= size) |