|
1 | 1 | /********************************************************************** |
2 | 2 | * plpython.c - python as a procedural language for PostgreSQL |
3 | 3 | * |
4 | | - *$PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.140 2010/03/1813:23:56 petere Exp $ |
| 4 | + *$PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.141 2010/03/1819:43:03 petere Exp $ |
5 | 5 | * |
6 | 6 | ********************************************************************* |
7 | 7 | */ |
@@ -2174,6 +2174,7 @@ PLyObject_ToDatum(PLyTypeInfo *info, |
2174 | 2174 | errmsg("could not convert Python object into cstring: Python string representation appears to contain null bytes"))); |
2175 | 2175 | elseif (slen>plen) |
2176 | 2176 | elog(ERROR,"could not convert Python object into cstring: Python string longer than reported length"); |
| 2177 | +pg_verifymbstr(plrv_sc,slen, false); |
2177 | 2178 | rv=InputFunctionCall(&arg->typfunc,plrv_sc,arg->typioparam,-1); |
2178 | 2179 | } |
2179 | 2180 | PG_CATCH(); |
@@ -2871,6 +2872,7 @@ PLy_spi_prepare(PyObject *self, PyObject *args) |
2871 | 2872 | } |
2872 | 2873 | } |
2873 | 2874 |
|
| 2875 | +pg_verifymbstr(query,strlen(query), false); |
2874 | 2876 | plan->plan=SPI_prepare(query,plan->nargs,plan->types); |
2875 | 2877 | if (plan->plan==NULL) |
2876 | 2878 | elog(ERROR,"SPI_prepare failed: %s", |
@@ -3078,6 +3080,7 @@ PLy_spi_execute_query(char *query, long limit) |
3078 | 3080 | oldcontext=CurrentMemoryContext; |
3079 | 3081 | PG_TRY(); |
3080 | 3082 | { |
| 3083 | +pg_verifymbstr(query,strlen(query), false); |
3081 | 3084 | rv=SPI_execute(query,PLy_curr_procedure->fn_readonly,limit); |
3082 | 3085 | } |
3083 | 3086 | PG_CATCH(); |
@@ -3353,6 +3356,7 @@ PLy_output(volatile int level, PyObject *self, PyObject *args) |
3353 | 3356 | oldcontext=CurrentMemoryContext; |
3354 | 3357 | PG_TRY(); |
3355 | 3358 | { |
| 3359 | +pg_verifymbstr(sv,strlen(sv), false); |
3356 | 3360 | elog(level,"%s",sv); |
3357 | 3361 | } |
3358 | 3362 | PG_CATCH(); |
|