From cb65e6426cf8f07dd6f0416424003be7b7479ee7 Mon Sep 17 00:00:00 2001 From: carl Date: Tue, 14 May 2019 23:14:59 +0800 Subject: [PATCH] Memory overflow bugfix --- lang/pc/comp/cstoper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/pc/comp/cstoper.c b/lang/pc/comp/cstoper.c index 3acf027fc..07ebc0288 100644 --- a/lang/pc/comp/cstoper.c +++ b/lang/pc/comp/cstoper.c @@ -486,7 +486,7 @@ void InitCst(void) max_int = full_mask[int_size] & ~(1L << (int_size * 8 - 1)); min_int = - max_int; maxint_str = long2str(max_int, 10); - maxint_str = Salloc(maxint_str, (unsigned int) strlen(maxint_str)); + maxint_str = Salloc(maxint_str, (unsigned int) strlen(maxint_str)+sizeof(char)); wrd_bits = 8 * (int) word_size; if( !max_intset ) max_intset = wrd_bits - 1; }