]> granicus.if.org Git - postgresql/commitdiff
Fix off-by-one check that can lead to a memory overflow in ecpg.
authorMichael Meskes <meskes@postgresql.org>
Thu, 11 Apr 2019 18:56:17 +0000 (20:56 +0200)
committerMichael Meskes <meskes@postgresql.org>
Thu, 11 Apr 2019 19:06:10 +0000 (21:06 +0200)
Patch by Liu Huailing <liuhuailing@cn.fujitsu.com>

src/interfaces/ecpg/preproc/pgc.l

index b139e1331cbe7652d2df230ce1451ec7d49ad001..490b22c6dafb30018506c249e8c9679a2ec59229 100644 (file)
@@ -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;