diff options
author | Michael Meskes <meskes@postgresql.org> | 2016-12-22 08:28:13 +0100 |
---|---|---|
committer | Michael Meskes <meskes@postgresql.org> | 2016-12-22 08:29:33 +0100 |
commit | a88c547f926c1bd70d7dc180826e7e95824c88d1 (patch) | |
tree | f0f91cf2e50544586fc09c7826b40ecdbcb5d39a /src/interfaces/ecpg/preproc/ecpg.c | |
parent | 28c9b6be7f76d64397bfa39a944915d4dbfd1994 (diff) |
Fix buffer overflow on particularly named files and clarify documentation about
output file naming.
Patch by Tsunakawa, Takayuki <tsunakawa.takay@jp.fujitsu.com>
Diffstat (limited to 'src/interfaces/ecpg/preproc/ecpg.c')
-rw-r--r-- | src/interfaces/ecpg/preproc/ecpg.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/preproc/ecpg.c index d8647b3c9d0..cfadb071f02 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 */ |