Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit fa3aa5e

Browse files
committed
Wrong boundary condition on number-of-args check.
1 parent cc2e19e commit fa3aa5e

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

src/backend/catalog/pg_proc.c

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.38 2000/01/11 02:30:05 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.39 2000/01/11 05:22:25 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -80,8 +80,9 @@ ProcedureCreate(char *procedureName,
8080
{
8181
Value *t = lfirst(x);
8282

83-
if (parameterCount > FUNC_MAX_ARGS)
84-
elog(ERROR, "Procedures cannot take more than %d arguments",FUNC_MAX_ARGS);
83+
if (parameterCount >= FUNC_MAX_ARGS)
84+
elog(ERROR, "Procedures cannot take more than %d arguments",
85+
FUNC_MAX_ARGS);
8586

8687
if (strcmp(strVal(t), "opaque") == 0)
8788
{
@@ -172,7 +173,6 @@ ProcedureCreate(char *procedureName,
172173
elog(ERROR, "ProcedureCreate: sql functions cannot return type \"opaque\"");
173174
typeObjectId = 0;
174175
}
175-
176176
else
177177
{
178178
typeObjectId = TypeGet(returnTypeName, &defined);
@@ -192,7 +192,6 @@ ProcedureCreate(char *procedureName,
192192
returnTypeName);
193193
}
194194
}
195-
196195
else if (!defined)
197196
{
198197
elog(NOTICE, "ProcedureCreate: return type '%s' is only a shell",
@@ -247,7 +246,7 @@ ProcedureCreate(char *procedureName,
247246
prosrc = procedureName;
248247
if (fmgr_lookupByName(prosrc) == (func_ptr) NULL)
249248
elog(ERROR,
250-
"ProcedureCreate: there is no builtin function named \"%s\"",
249+
"ProcedureCreate: there is no builtin function named \"%s\"",
251250
prosrc);
252251
}
253252

@@ -266,30 +265,18 @@ ProcedureCreate(char *procedureName,
266265
values[i++] = NameGetDatum(&procname);
267266
values[i++] = Int32GetDatum(GetUserId());
268267
values[i++] = ObjectIdGetDatum(languageObjectId);
269-
270268
/* XXX isinherited is always false for now */
271-
272269
values[i++] = Int8GetDatum((bool) 0);
273-
274-
/* XXX istrusted is always false for now */
275-
276270
values[i++] = Int8GetDatum(trusted);
277271
values[i++] = Int8GetDatum(canCache);
278272
values[i++] = UInt16GetDatum(parameterCount);
279273
values[i++] = Int8GetDatum(returnsSet);
280274
values[i++] = ObjectIdGetDatum(typeObjectId);
281-
282275
values[i++] = (Datum) typev;
283-
284-
/*
285-
* The following assignments of constants are made. The real values
286-
* will have to be extracted from the arglist someday soon.
287-
*/
288276
values[i++] = Int32GetDatum(byte_pct); /* probyte_pct */
289277
values[i++] = Int32GetDatum(perbyte_cpu); /* properbyte_cpu */
290278
values[i++] = Int32GetDatum(percall_cpu); /* propercall_cpu */
291279
values[i++] = Int32GetDatum(outin_ratio); /* prooutin_ratio */
292-
293280
values[i++] = (Datum) fmgr(F_TEXTIN, prosrc); /* prosrc */
294281
values[i++] = (Datum) fmgr(F_TEXTIN, probin); /* probin */
295282

0 commit comments

Comments
 (0)