aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2019-03-11 16:11:16 +0100
committerMichael Meskes <meskes@postgresql.org>2019-03-11 16:15:09 +0100
commit5469a1e78c92a3ce9ed232583273c53223e83b63 (patch)
treedaa864b38e9f036f904dbcd54ed4a98ec50d6c62 /src
parentcadead6c3c8ed81e09a3cb5101ff453758412f54 (diff)
downloadpostgresql-5469a1e78c92a3ce9ed232583273c53223e83b63.tar.gz
postgresql-5469a1e78c92a3ce9ed232583273c53223e83b63.zip
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>
Diffstat (limited to 'src')
-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 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");