Index: src/pl/plpgsql/src/gram.y
===================================================================
RCS file: /var/lib/cvs/pgsql/src/pl/plpgsql/src/gram.y,v
retrieving revision 1.64
diff -c -r1.64 gram.y
*** src/pl/plpgsql/src/gram.y	25 Oct 2004 06:27:21 -0000	1.64
--- src/pl/plpgsql/src/gram.y	20 Jan 2005 04:39:01 -0000
***************
*** 474,479 ****
--- 474,483 ----
  					{
  						int i = $1->nfields++;
  
+ 						/* Guard against overflowing the array on malicious input */
+ 						if (i >= 1024)
+ 							yyerror("too many parameters specified for refcursor");
+ 
  						$1->fieldnames[i] = $3->refname;
  						$1->varnos[i] = $3->dno;
  
