Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6fcd501

Browse files
committed
Add checks for valid encoding of query strings passed to SPI by plperl.
1 parentb989662 commit6fcd501

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

‎src/pl/plperl/plperl.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**********************************************************************
22
* plperl.c - perl as a procedural language for PostgreSQL
33
*
4-
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.169 2010/02/26 02:01:33momjian Exp $
4+
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.170 2010/03/09 02:48:33adunstan Exp $
55
*
66
**********************************************************************/
77

@@ -2102,6 +2102,8 @@ plperl_spi_exec(char *query, int limit)
21022102
{
21032103
intspi_rv;
21042104

2105+
pg_verifymbstr(query,strlen(query), false);
2106+
21052107
spi_rv=SPI_execute(query,current_call_data->prodesc->fn_readonly,
21062108
limit);
21072109
ret_hv=plperl_spi_execute_fetch_result(SPI_tuptable,SPI_processed,
@@ -2343,6 +2345,9 @@ plperl_spi_query(char *query)
23432345
void*plan;
23442346
Portalportal;
23452347

2348+
/* Make sure the query is validly encoded */
2349+
pg_verifymbstr(query,strlen(query), false);
2350+
23462351
/* Create a cursor for the query */
23472352
plan=SPI_prepare(query,0,NULL);
23482353
if (plan==NULL)
@@ -2549,6 +2554,9 @@ plperl_spi_prepare(char *query, int argc, SV **argv)
25492554
qdesc->argtypioparams[i]=typIOParam;
25502555
}
25512556

2557+
/* Make sure the query is validly encoded */
2558+
pg_verifymbstr(query,strlen(query), false);
2559+
25522560
/************************************************************
25532561
* Prepare the plan and check for errors
25542562
************************************************************/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp