1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

Fix off-by-one check that can lead to a memory overflow in ecpg.

Patch by Liu Huailing <liuhuailing@cn.fujitsu.com>
This commit is contained in:
Michael Meskes
2019-04-11 20:56:17 +02:00
parent d3cf886e31
commit 67f6e645e7

View File

@ -1412,7 +1412,7 @@ parse_include(void)
for (ip = include_paths; yyin == NULL && ip != NULL; ip = ip->next) 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); fprintf(stderr, _("Error: include path \"%s/%s\" is too long on line %d, skipping\n"), ip->path, yytext, yylineno);
continue; continue;