Several operations were not safe to call on empty pack and would
return invalid memory. If the pack would have reserved space, but
would be empty (length = 0), it's head would be NULL but tail would
be array address (pack->at + 0). This is mostly checked by caller,
but it wasn't in several places (object deletion).
assert(obj != NULL);
return NULL;
}
+
uint8_t *endp = pack_tail(*pack);
uint8_t *it = pack_head(*pack);
while (it != endp) {
assert(obj != NULL);
return kr_error(EINVAL);
}
+
uint8_t *endp = pack_tail(*pack);
uint8_t *it = pack_obj_find(pack, obj, len);
if (it) {