mirror of
https://github.com/postgres/postgres.git
synced 2025-07-07 00:36:50 +03:00
Defend against function calls with more than 8 arguments (code
used to overrun its fixed-size arrays before detecting error; not cool). Also, replace uses of magic constant '8' with 'MAXFARGS'.
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.17 1999/05/29 03:17:19 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.18 1999/06/17 22:21:41 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -20,6 +20,7 @@
|
||||
#include "parser/parse_expr.h"
|
||||
|
||||
#include "catalog/pg_type.h"
|
||||
#include "parser/parse_func.h"
|
||||
#include "parser/parse_type.h"
|
||||
#include "parser/parse_target.h"
|
||||
#include "parser/parse_coerce.h"
|
||||
@ -132,7 +133,7 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *func_typeids)
|
||||
HeapTuple ftup;
|
||||
int i;
|
||||
Type tp;
|
||||
Oid oid_array[8];
|
||||
Oid oid_array[MAXFARGS];
|
||||
|
||||
/* run through argument list... */
|
||||
for (i = 0; i < nargs; i++)
|
||||
@ -160,7 +161,7 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *func_typeids)
|
||||
*/
|
||||
else if (input_typeids[i] != UNKNOWNOID)
|
||||
{
|
||||
MemSet(&oid_array[0], 0, 8 * sizeof(Oid));
|
||||
MemSet(oid_array, 0, MAXFARGS * sizeof(Oid));
|
||||
oid_array[0] = input_typeids[i];
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user