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

Commit3ace845

Browse files
committed
Defend against omitted paramLengths[] array in PQsendQueryParams.
Per Volkan Yazici.
1 parent0b8e46e commit3ace845

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

‎src/interfaces/libpq/fe-exec.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.167 2005/04/29 13:42:21 momjian Exp $
11+
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.168 2005/06/09 20:01:16 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -30,7 +30,7 @@
3030
#endif
3131

3232
/* keep this in same order as ExecStatusType in libpq-fe.h */
33-
char*constpgresStatus[]= {
33+
char*constpgresStatus[]= {
3434
"PGRES_EMPTY_QUERY",
3535
"PGRES_COMMAND_OK",
3636
"PGRES_TUPLES_OK",
@@ -960,7 +960,14 @@ PQsendQueryGuts(PGconn *conn,
960960
if (paramFormats&&paramFormats[i]!=0)
961961
{
962962
/* binary parameter */
963-
nbytes=paramLengths[i];
963+
if (paramLengths)
964+
nbytes=paramLengths[i];
965+
else
966+
{
967+
printfPQExpBuffer(&conn->errorMessage,
968+
libpq_gettext("length must be given for binary parameter\n"));
969+
gotosendFailed;
970+
}
964971
}
965972
else
966973
{

‎src/interfaces/libpq/libpq-fe.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.116 2004/12/31 22:03:50 pgsql Exp $
10+
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.117 2005/06/09 20:01:16 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -156,7 +156,7 @@ typedef struct _PQprintOpt
156156
char*fieldSep;/* field separator */
157157
char*tableOpt;/* insert to HTML <table ...> */
158158
char*caption;/* HTML <caption> */
159-
char**fieldName;/* null terminated array ofrepalcement
159+
char**fieldName;/* null terminated array ofreplacement
160160
* field names */
161161
}PQprintOpt;
162162

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp