|
1 | 1 | /**********************************************************************
|
2 | 2 | * plperl.c - perl as a procedural language for PostgreSQL
|
3 | 3 | *
|
4 |
| - * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.169 2010/02/26 02:01:33 momjian Exp $ |
| 4 | + * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.170 2010/03/09 02:48:33 adunstan Exp $ |
5 | 5 | *
|
6 | 6 | **********************************************************************/
|
7 | 7 |
|
@@ -2102,6 +2102,8 @@ plperl_spi_exec(char *query, int limit)
|
2102 | 2102 | {
|
2103 | 2103 | int spi_rv;
|
2104 | 2104 |
|
| 2105 | + pg_verifymbstr(query, strlen(query), false); |
| 2106 | + |
2105 | 2107 | spi_rv = SPI_execute(query, current_call_data->prodesc->fn_readonly,
|
2106 | 2108 | limit);
|
2107 | 2109 | ret_hv = plperl_spi_execute_fetch_result(SPI_tuptable, SPI_processed,
|
@@ -2343,6 +2345,9 @@ plperl_spi_query(char *query)
|
2343 | 2345 | void *plan;
|
2344 | 2346 | Portal portal;
|
2345 | 2347 |
|
| 2348 | + /* Make sure the query is validly encoded */ |
| 2349 | + pg_verifymbstr(query, strlen(query), false); |
| 2350 | + |
2346 | 2351 | /* Create a cursor for the query */
|
2347 | 2352 | plan = SPI_prepare(query, 0, NULL);
|
2348 | 2353 | if (plan == NULL)
|
@@ -2549,6 +2554,9 @@ plperl_spi_prepare(char *query, int argc, SV **argv)
|
2549 | 2554 | qdesc->argtypioparams[i] = typIOParam;
|
2550 | 2555 | }
|
2551 | 2556 |
|
| 2557 | + /* Make sure the query is validly encoded */ |
| 2558 | + pg_verifymbstr(query, strlen(query), false); |
| 2559 | + |
2552 | 2560 | /************************************************************
|
2553 | 2561 | * Prepare the plan and check for errors
|
2554 | 2562 | ************************************************************/
|
|
0 commit comments