summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meskes2019-03-11 15:11:16 +0000
committerMichael Meskes2019-03-11 15:26:59 +0000
commit8cdce0a455ff885e99d672dbd8edbd217d68139f (patch)
treed28fb0f6692a145114fb27e7ee0fb938ca7634cc
parent5aafedc2fdbdbe4efcb749b0f20a925436d18d06 (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.l2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l
index 3645582b439..cc1f0709b3f 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");