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: REL_10_8~67 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5469a1e78c92a3ce9ed232583273c53223e83b63;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 5ed185a20b6..deb1e554ce9 100644 --- a/src/interfaces/ecpg/preproc/pgc.l +++ b/src/interfaces/ecpg/preproc/pgc.l @@ -1393,7 +1393,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");