|
4 | 4 | * procedural language |
5 | 5 | * |
6 | 6 | * IDENTIFICATION |
7 | | - * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/gram.y,v 1.29.2.2 2005/01/27 01:52:34 neilc Exp $ |
| 7 | + * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/gram.y,v 1.29.2.3 2005/02/08 18:22:54 tgl Exp $ |
8 | 8 | * |
9 | 9 | * This software is copyrighted by Jan Wieck - Hamburg. |
10 | 10 | * |
@@ -1565,6 +1565,14 @@ read_sql_construct(int until, |
1565 | 1565 | } |
1566 | 1566 | if (plpgsql_SpaceScanned) |
1567 | 1567 | plpgsql_dstring_append(&ds, " "); |
| 1568 | + |
| 1569 | + /* Check for array overflow */ |
| 1570 | + if (nparams >= 1024) |
| 1571 | + { |
| 1572 | + plpgsql_error_lineno = lno; |
| 1573 | + elog(ERROR, "too many variables specified in SQL statement"); |
| 1574 | + } |
| 1575 | + |
1568 | 1576 | switch (tok) |
1569 | 1577 | { |
1570 | 1578 | case T_VARIABLE: |
@@ -1708,6 +1716,14 @@ make_select_stmt() |
1708 | 1716 |
|
1709 | 1717 | if (plpgsql_SpaceScanned) |
1710 | 1718 | plpgsql_dstring_append(&ds, " "); |
| 1719 | + |
| 1720 | + /* Check for array overflow */ |
| 1721 | + if (nparams >= 1024) |
| 1722 | + { |
| 1723 | + plpgsql_error_lineno = yylineno; |
| 1724 | + elog(ERROR, "too many variables specified in SQL statement"); |
| 1725 | + } |
| 1726 | + |
1711 | 1727 | switch (tok) |
1712 | 1728 | { |
1713 | 1729 | case T_VARIABLE: |
@@ -1776,6 +1792,13 @@ make_select_stmt() |
1776 | 1792 |
|
1777 | 1793 | while ((tok = yylex()) == ',') |
1778 | 1794 | { |
| 1795 | + /* Check for array overflow */ |
| 1796 | + if (nfields >= 1024) |
| 1797 | + { |
| 1798 | + plpgsql_error_lineno = yylineno; |
| 1799 | + elog(ERROR, "too many INTO variables specified"); |
| 1800 | + } |
| 1801 | + |
1779 | 1802 | tok = yylex(); |
1780 | 1803 | switch(tok) |
1781 | 1804 | { |
@@ -1992,6 +2015,13 @@ make_fetch_stmt() |
1992 | 2015 |
|
1993 | 2016 | while ((tok = yylex()) == ',') |
1994 | 2017 | { |
| 2018 | + /* Check for array overflow */ |
| 2019 | + if (nfields >= 1024) |
| 2020 | + { |
| 2021 | + plpgsql_error_lineno = yylineno; |
| 2022 | + elog(ERROR, "too many INTO variables specified"); |
| 2023 | + } |
| 2024 | + |
1995 | 2025 | tok = yylex(); |
1996 | 2026 | switch(tok) |
1997 | 2027 | { |
|
0 commit comments