Skip to content

Commit

Permalink
Fixed when function with variadic arguments did not work correctly (#123
Browse files Browse the repository at this point in the history
) (#138)

If a function has variadic arguments, postgres may crash when the wrong number
of arguments may be passed to postgres.
  • Loading branch information
zwyan0 authored Jan 13, 2023
1 parent 300d058 commit 27c0206
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/parser_function.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,13 +321,13 @@ FunctionParserInit(FunctionParser *self, Checker *checker, const char *infile, T
ReleaseSysCache(ftup);

#if PG_VERSION_NUM >= 120000
InitFunctionCallInfoData(*self->fcinfo, &self->flinfo, nargs,
InitFunctionCallInfoData(*self->fcinfo, &self->flinfo, self->flinfo.fn_nargs,
collation, NULL, (Node *) &self->rsinfo);
#elif PG_VERSION_NUM >= 90100
InitFunctionCallInfoData(self->fcinfo, &self->flinfo, nargs,
InitFunctionCallInfoData(self->fcinfo, &self->flinfo, self->flinfo.fn_nargs,
collation, NULL, (Node *) &self->rsinfo);
#else
InitFunctionCallInfoData(self->fcinfo, &self->flinfo, nargs,
InitFunctionCallInfoData(self->fcinfo, &self->flinfo, self->flinfo.fn_nargs,
NULL, (Node *) &self->rsinfo);
#endif

Expand Down

0 comments on commit 27c0206

Please sign in to comment.