Fix off-by-one check that can lead to a memory overflow in ecpg.
authorMichael Meskes
Thu, 11 Apr 2019 18:56:17 +0000 (20:56 +0200)
committerMichael Meskes
Thu, 11 Apr 2019 19:04:37 +0000 (21:04 +0200)
Patch by Liu Huailing 

src/interfaces/ecpg/preproc/pgc.l

index 56682067aff4ec4c7539fb32afcd45418520e288..4a63da7084b5bb1877e469c85040fd22d938618a 100644 (file)
@@ -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;