postgres.git / summary / log / commit / refs

commit    e7e71b9e1ecb8cb6eb490b0c82bdc5aa9604368b
Author:   Michael Meskes <meskes@postgresql.org>
Date:     Thu Apr 11 18:56:17 2019 +0000
First released in: 12.0, 9.4.22, 9.5.17, 9.6.13, 10.8, 11.3

    Fix off-by-one check that can lead to a memory overflow in ecpg.
    
    Patch by Liu Huailing <liuhuailing@cn.fujitsu.com>


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 deb1e554ce9..c3670b94d75 100644 --- a/src/interfaces/ecpg/preproc/pgc.l +++ b/src/interfaces/ecpg/preproc/pgc.l @@ -1411,7 +1411,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; [parent: 2c31332267ea]