From b6191c61f8db29bbd2f913f9242db5852050c10d Mon Sep 17 00:00:00 2001 From: Alexander Potashev Date: Fri, 27 May 2011 04:36:48 +0400 Subject: [PATCH 1/5] Copy string from shared buffer The buffer "buf" will be reused for other strings. If we pass the pointer to it to other code, it might later access free'd memory using that pointer. --- po-lex.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/po-lex.c b/po-lex.c index 98943ec..54de3d4 100644 --- a/po-lex.c +++ b/po-lex.c @@ -945,7 +945,7 @@ po_gram_lex () } buf[bufpos] = '\0'; - po_gram_lval.string.string = buf; + po_gram_lval.string.string = xstrdup (buf); po_gram_lval.string.pos = gram_pos; po_gram_lval.string.obsolete = po_lex_obsolete; po_lex_obsolete = false; -- 1.7.5.rc3