diff options
author | Michael Meskes <meskes@postgresql.org> | 2019-03-11 16:11:16 +0100 |
---|---|---|
committer | Michael Meskes <meskes@postgresql.org> | 2019-03-11 16:14:03 +0100 |
commit | e7adda86ba9c8dc1d0db07d0049ccfff42082a0e (patch) | |
tree | 19937a626a49cc1327864a26f4ae136e115c0bf2 | |
parent | b16f8a2905820e41cc8390364b0acef4d8a6bfca (diff) |
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>
-rw-r--r-- | src/interfaces/ecpg/preproc/pgc.l | 2 |
1 files changed, 1 insertions, 1 deletions
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"); |