From: Robert Spalek Date: Thu, 27 Apr 2006 16:28:12 +0000 (+0200) Subject: conf2: fix appending to a dynamic array set to NULL X-Git-Tag: holmes-import~645^2~11^2~17 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=6f0815f2e7aa8ff78ccee9f7d2cd378fae0c51d4;p=libucw.git conf2: fix appending to a dynamic array set to NULL --- diff --git a/lib/conf2.c b/lib/conf2.c index ad3839ae..04c20992 100644 --- a/lib/conf2.c +++ b/lib/conf2.c @@ -697,7 +697,7 @@ interpret_add_dynamic(struct cf_item *item, int number, byte **pars, int *proces 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 old_nr = old_p ? * (int*) (old_p - size) : 0; int taken = MIN(number, ABS(item->number)-old_nr); *processed = taken; // stretch the dynamic array