1
0
mirror of https://github.com/postgres/postgres.git synced 2025-04-22 23:02:54 +03:00

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>
This commit is contained in:
Michael Meskes 2019-03-11 16:11:16 +01:00
parent 98bdaab0d9
commit 08cecfaf60

View File

@ -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");