diff options
| author | Michael Meskes | 2019-03-11 15:11:16 +0000 |
|---|---|---|
| committer | Michael Meskes | 2019-03-11 15:17:17 +0000 |
| commit | 72f725ab25bdf4ad12c9586521935eb9307fcfe1 (patch) | |
| tree | 859f62539a50bc0fb379c1ff2ddbc7cfa6608c52 | |
| parent | d8f8183c04671b0ffe26ae6f8aee9e50df5fff1e (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 af0ba44de85..b139e1331cb 100644 --- a/src/interfaces/ecpg/preproc/pgc.l +++ b/src/interfaces/ecpg/preproc/pgc.l @@ -1394,7 +1394,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"); |
