1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-27 23:21:58 +03:00

Defend against omitted paramLengths[] array in PQsendQueryParams.

Per Volkan Yazici.
This commit is contained in:
Tom Lane
2005-06-09 20:01:16 +00:00
parent 0b8e46e49b
commit 3ace84594e
2 changed files with 12 additions and 5 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.167 2005/04/29 13:42:21 momjian Exp $
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.168 2005/06/09 20:01:16 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -30,7 +30,7 @@
#endif
/* keep this in same order as ExecStatusType in libpq-fe.h */
char *const pgresStatus[] = {
char *const pgresStatus[] = {
"PGRES_EMPTY_QUERY",
"PGRES_COMMAND_OK",
"PGRES_TUPLES_OK",
@ -960,7 +960,14 @@ PQsendQueryGuts(PGconn *conn,
if (paramFormats && paramFormats[i] != 0)
{
/* binary parameter */
nbytes = paramLengths[i];
if (paramLengths)
nbytes = paramLengths[i];
else
{
printfPQExpBuffer(&conn->errorMessage,
libpq_gettext("length must be given for binary parameter\n"));
goto sendFailed;
}
}
else
{