From: Peter Johnson Date: Wed, 19 Oct 2005 07:57:32 +0000 (-0000) Subject: * gas-token.re (strbuf_append): Allocate before store (otherwise crash is X-Git-Tag: v0.5.0rc1~88 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=40886e0c3a3ec4a65ce6429cb06fced9198d743a;p=yasm * gas-token.re (strbuf_append): Allocate before store (otherwise crash is possible). svn path=/trunk/yasm/; revision=1290 --- diff --git a/modules/parsers/gas/gas-token.re b/modules/parsers/gas/gas-token.re index 2f5974f0..9692559e 100644 --- a/modules/parsers/gas/gas-token.re +++ b/modules/parsers/gas/gas-token.re @@ -145,12 +145,12 @@ strbuf_append(size_t count, YYCTYPE *cursor, Scanner *s, unsigned long line, { if (cursor == s->eof) yasm__error(line, N_("unexpected end of file in string")); - strbuf[count] = ch; if (count >= strbuf_size) { strbuf = yasm_xrealloc(strbuf, strbuf_size + STRBUF_ALLOC_SIZE); strbuf_size += STRBUF_ALLOC_SIZE; } + strbuf[count] = ch; } /*!re2c