From: Martin Mares Date: Thu, 5 Aug 2004 22:33:19 +0000 (+0000) Subject: obj_add_attr_ref() with an on-stack buffer is not advisable, better X-Git-Tag: holmes-import~926 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=c673da72822d7704572716de80402829921efdc3;p=libucw.git obj_add_attr_ref() with an on-stack buffer is not advisable, better allocate the buffer in the object pool. --- diff --git a/lib/buck2obj.c b/lib/buck2obj.c index 18ce8e21..d75b48ab 100644 --- a/lib/buck2obj.c +++ b/lib/buck2obj.c @@ -123,12 +123,12 @@ buck2obj_parse(struct buck2obj_buf *buf, uns buck_type, uns buck_len, struct fas while (btell(body) < end) { uns len = bget_utf8(body); - if (!len--) + if (!len) break; - byte buf[MAX_ATTR_SIZE]; + byte *buf = mp_alloc_fast_noalign(o_hdr->pool, len); bread(body, buf, len); + uns type = buf[--len]; buf[len] = 0; - byte type = bgetc(body); obj_add_attr_ref(o_hdr, type, buf); } *body_start = btell(body) - start;