]> mj.ucw.cz Git - libucw.git/commitdiff
conf2: fix appending to a dynamic array set to NULL
authorRobert Spalek <robert@ucw.cz>
Thu, 27 Apr 2006 16:28:12 +0000 (18:28 +0200)
committerRobert Spalek <robert@ucw.cz>
Thu, 27 Apr 2006 16:28:12 +0000 (18:28 +0200)
lib/conf2.c

index ad3839ae555066c2e50c82f143648f66b8a3956a..04c20992f72316a5245f37d82fede8b0861f4b78 100644 (file)
@@ -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