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:11:16 +0100
commit08cecfaf60c484f219ba7e6ee23e9699aea4e9af (patch)
treef03b0172697f75add301410c19fc31980839af57 /src
parent98bdaab0d918169a36d64a06667a809c673ec065 (diff)
downloadpostgresql-08cecfaf60c484f219ba7e6ee23e9699aea4e9af.tar.gz
postgresql-08cecfaf60c484f219ba7e6ee23e9699aea4e9af.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 3f7a5d79998..60474b0b4a6 100644
--- a/src/interfaces/ecpg/preproc/pgc.l
+++ b/src/interfaces/ecpg/preproc/pgc.l
@@ -1538,7 +1538,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");