From 127fe71f2d6e30902cbdebca148cf10e224d95b5 Mon Sep 17 00:00:00 2001 From: Robert Spalek Date: Tue, 25 Apr 2006 23:28:04 +0200 Subject: [PATCH] conf2: add 2 ASSERT's on checking the user-defined type size --- lib/conf2.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/conf2.c b/lib/conf2.c index 7ef69ff9..8e3028a3 100644 --- a/lib/conf2.c +++ b/lib/conf2.c @@ -675,6 +675,7 @@ interpret_set_dynamic(struct cf_item *item, int number, byte **pars, void **ptr) cf_journal_block(ptr, sizeof(void*)); // boundary checks done by the caller uns size = type_size(item->type, item->u.utype); + ASSERT(size >= sizeof(uns)); *ptr = cf_malloc((number+1) * size) + size; * (uns*) (*ptr - size) = number; return cf_parse_ary(number, pars, *ptr, type, &item->u); @@ -686,6 +687,7 @@ interpret_add_dynamic(struct cf_item *item, int number, byte **pars, int *proces enum cf_type type = item->type; void *old_p = *ptr; uns size = type_size(item->type, item->u.utype); + ASSERT(size >= sizeof(uns)); int old_nr = * (int*) (old_p - size); int taken = MIN(number, item->number-old_nr); *processed = taken; -- 2.39.2