postgres.git / summary / log / commit / refs

commit    e7adda86ba9c8dc1d0db07d0049ccfff42082a0e
Author:   Michael Meskes <meskes@postgresql.org>
Date:     Mon Mar 11 15:11:16 2019 +0000
First released in: 12.0, 9.4.22, 9.5.17, 9.6.13, 10.8, 11.3

    Fix potential memory access violation in ecpg if filename of include file is
    shorter than 2 characters.
    
    Patch by: "Wu, Fei" <wufei.fnst@cn.fujitsu.com>


src/interfaces/ecpg/preproc/pgc.l | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l index 0792118cfe3..56682067aff 100644 --- a/src/interfaces/ecpg/preproc/pgc.l +++ b/src/interfaces/ecpg/preproc/pgc.l @@ -1396,7 +1396,7 @@ parse_include(void) yyin = fopen(inc_file, "r"); if (!yyin) { - if (strcmp(inc_file + strlen(inc_file) - 2, ".h") != 0) + if (strlen(inc_file) <= 2 || strcmp(inc_file + strlen(inc_file) - 2, ".h") != 0) { strcat(inc_file, ".h"); yyin = fopen(inc_file, "r"); [parent: b16f8a290582]