From: Michael Meskes Date: Thu, 11 Apr 2019 18:56:17 +0000 (+0200) Subject: Fix off-by-one check that can lead to a memory overflow in ecpg. X-Git-Tag: REL9_6_13~26 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=77300684867f93aebd29de106f8adcf0797bcb21;p=postgresql Fix off-by-one check that can lead to a memory overflow in ecpg. Patch by Liu Huailing --- diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l index cc1f0709b3..c2b8bf01b5 100644 --- a/src/interfaces/ecpg/preproc/pgc.l +++ b/src/interfaces/ecpg/preproc/pgc.l @@ -1412,7 +1412,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;