From c673da72822d7704572716de80402829921efdc3 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Thu, 5 Aug 2004 22:33:19 +0000 Subject: [PATCH] obj_add_attr_ref() with an on-stack buffer is not advisable, better allocate the buffer in the object pool. --- lib/buck2obj.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; -- 2.39.2