From 0ba09cc026985536586b7fd58ceddee16ea739d7 Mon Sep 17 00:00:00 2001 From: Michael Meskes Date: Thu, 11 Apr 2019 20:56:17 +0200 Subject: [PATCH] Fix off-by-one check that can lead to a memory overflow in ecpg. Patch by Liu Huailing --- src/interfaces/ecpg/preproc/pgc.l | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l index 56682067af..4a63da7084 100644 --- a/src/interfaces/ecpg/preproc/pgc.l +++ b/src/interfaces/ecpg/preproc/pgc.l @@ -1414,7 +1414,7 @@ parse_include(void) for (ip = include_paths; yyin == NULL && ip != NULL; ip = ip->next) { - if (strlen(ip->path) + strlen(yytext) + 3 > MAXPGPATH) + if (strlen(ip->path) + strlen(yytext) + 4 > MAXPGPATH) { fprintf(stderr, _("Error: include path \"%s/%s\" is too long on line %d, skipping\n"), ip->path, yytext, yylineno); continue;