Skip to content

Commit 08cecfa

Browse files
author
Michael Meskes
committed
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>
1 parent 98bdaab commit 08cecfa

File tree

1 file changed

+1
-1
lines changed
  • src/interfaces/ecpg/preproc

1 file changed

+1
-1
lines changed

src/interfaces/ecpg/preproc/pgc.l

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1538,7 +1538,7 @@ parse_include(void)
15381538
yyin = fopen(inc_file, "r");
15391539
if (!yyin)
15401540
{
1541-
if (strcmp(inc_file + strlen(inc_file) - 2, ".h") != 0)
1541+
if (strlen(inc_file) <= 2 || strcmp(inc_file + strlen(inc_file) - 2, ".h") != 0)
15421542
{
15431543
strcat(inc_file, ".h");
15441544
yyin = fopen(inc_file, "r");

0 commit comments

Comments
 (0)