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>
pull/39/head
Michael Meskes 7 years ago
parent 98bdaab0d9
commit 08cecfaf60
  1. 2
      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");

Loading…
Cancel
Save