Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5469a1e

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" <[email protected]>
1 parent cadead6 commit 5469a1e

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
@@ -1393,7 +1393,7 @@ parse_include(void)
13931393
yyin = fopen(inc_file, "r");
13941394
if (!yyin)
13951395
{
1396-
if (strcmp(inc_file + strlen(inc_file) - 2, ".h") != 0)
1396+
if (strlen(inc_file) <= 2 || strcmp(inc_file + strlen(inc_file) - 2, ".h") != 0)
13971397
{
13981398
strcat(inc_file, ".h");
13991399
yyin = fopen(inc_file, "r");

0 commit comments

Comments
 (0)