From: Michael Meskes Date: Mon, 11 Mar 2019 15:11:16 +0000 (+0100) Subject: Fix potential memory access violation in ecpg if filename of include file is X-Git-Tag: REL9_4_22~40 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e7e78f1598281a7543be563fb19c79b99826c943;p=thirdparty%2Fpostgresql.git Fix potential memory access violation in ecpg if filename of include file is shorter than 2 characters. Patch by: "Wu, Fei" --- diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l index aaaa5885d90..c388cb66ed5 100644 --- a/src/interfaces/ecpg/preproc/pgc.l +++ b/src/interfaces/ecpg/preproc/pgc.l @@ -1358,7 +1358,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");