]> git.pld-linux.org Git - packages/postgresql.git/commitdiff
- prevent 4 more buffer overruns in the PL/PgSQL parser
authorKarol Krenski <charles@pld-linux.org>
Thu, 10 Feb 2005 10:16:58 +0000 (10:16 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    postgresql-gram.patch -> 1.1

postgresql-gram.patch [new file with mode: 0644]

diff --git a/postgresql-gram.patch b/postgresql-gram.patch
new file mode 100644 (file)
index 0000000..65e7bb3
--- /dev/null
@@ -0,0 +1,66 @@
+--- postgresql-8.0.1/src/pl/plpgsql/src/gram.y.orig    2005-01-21 01:17:02.000000000 +0100
++++ postgresql-8.0.1/src/pl/plpgsql/src/gram.y 2005-02-10 11:07:36.310506816 +0100
+@@ -1792,6 +1792,15 @@
+                               plpgsql_dstring_append(&ds, yytext);
+                               break;
+               }
++
++              /* Check for array overflow */
++              if (nparams >= 1024)
++              {
++                      plpgsql_error_lineno = lno;
++                      ereport(ERROR,
++                                      (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
++                                       errmsg("too many variables specified in SQL statement")));
++              }
+       }
+       if (endtoken)
+@@ -1940,6 +1949,15 @@
+                                       while ((tok = yylex()) == ',')
+                                       {
++                                              /* Check for array overflow */
++                                              if (nfields >= 1024)
++                                              {
++                                                      plpgsql_error_lineno = plpgsql_scanner_lineno();
++                                                      ereport(ERROR,
++                                                                      (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
++                                                                       errmsg("too many INTO variables specified")));
++                                              }
++
+                                               tok = yylex();
+                                               switch(tok)
+                                               {
+@@ -2014,6 +2032,15 @@
+                               plpgsql_dstring_append(&ds, yytext);
+                               break;
+               }
++
++              /* Check for array overflow */
++              if (nparams >= 1024)
++              {
++                      plpgsql_error_lineno = plpgsql_scanner_lineno();
++                      ereport(ERROR,
++                                      (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
++                                       errmsg("too many variables specified in SQL statement")));
++              }
+       }
+       expr = malloc(sizeof(PLpgSQL_expr) + sizeof(int) * nparams - sizeof(int));
+@@ -2085,6 +2112,15 @@
+                               while ((tok = yylex()) == ',')
+                               {
++                                      /* Check for array overflow */
++                                      if (nfields >= 1024)
++                                      {
++                                              plpgsql_error_lineno = plpgsql_scanner_lineno();
++                                              ereport(ERROR,
++                                                              (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
++                                                               errmsg("too many INTO variables specified")));
++                                      }
++
+                                       tok = yylex();
+                                       switch(tok)
+                                       {
This page took 0.054024 seconds and 4 git commands to generate.