From 3af172f7b68763fbbf720d11be88784f21c4c1d1 Mon Sep 17 00:00:00 2001 From: Michael Meskes Date: Thu, 22 Dec 2016 08:28:13 +0100 Subject: Fix buffer overflow on particularly named files and clarify documentation about output file naming. Patch by Tsunakawa, Takayuki --- src/interfaces/ecpg/preproc/ecpg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/preproc/ecpg.c index 224731b3b4e..96a502a6447 100644 --- a/src/interfaces/ecpg/preproc/ecpg.c +++ b/src/interfaces/ecpg/preproc/ecpg.c @@ -313,7 +313,8 @@ main(int argc, char *const argv[]) base_yyout = stdout; else { - output_filename = mm_strdup(input_filename); + output_filename = mm_alloc(strlen(input_filename) + 3); + strcpy(output_filename, input_filename); ptr2ext = strrchr(output_filename, '.'); /* make extension = .c resp. .h */ -- cgit v1.2.3