From: Wolfgang (Blub) Bumiller Date: Fri, 23 Nov 2012 18:34:24 +0000 (+0100) Subject: Enforce a trailing nul-byte after preprocessing X-Git-Tag: 0.1.9~305 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=58c87ac328ec43a1e9170b6ac03df0c79ef9bc51;p=xonotic%2Fgmqcc.git Enforce a trailing nul-byte after preprocessing --- diff --git a/ftepp.c b/ftepp.c index 679214f..68d46b2 100644 --- a/ftepp.c +++ b/ftepp.c @@ -1236,6 +1236,10 @@ static bool ftepp_preprocess(ftepp_t *ftepp) } } while (!ftepp->errors && ftepp->token < TOKEN_EOF); + /* force a 0 at the end but don't count it as added to the output */ + vec_push(ftepp->output_string, 0); + vec_shrinkby(ftepp->output_string, 1); + newline = ftepp->token == TOKEN_EOF; return newline; }