File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 9
9
*
10
10
*
11
11
* IDENTIFICATION
12
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/oracle_compat.c,v 1.40 2002/08/22 04:55:05 momjian Exp $
12
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/oracle_compat.c,v 1.41 2002/08/22 05:05:19 momjian Exp $
13
13
*
14
14
*-------------------------------------------------------------------------
15
15
*/
@@ -1008,8 +1008,14 @@ repeat(PG_FUNCTION_ARGS)
1008
1008
tlen = (VARHDRSZ + (count * slen ));
1009
1009
1010
1010
/* Check for integer overflow */
1011
- if (slen != 0 && count != 0 && tlen / slen != count )
1012
- elog (ERROR , "Requested buffer is too large." );
1011
+ if (slen != 0 && count != 0 )
1012
+ {
1013
+ int check = count * slen ;
1014
+ int check2 = check + VARHDRSZ ;
1015
+
1016
+ if ((check / slen ) != count || check2 <= check )
1017
+ elog (ERROR , "Requested buffer is too large." );
1018
+ }
1013
1019
1014
1020
result = (text * ) palloc (tlen );
1015
1021
You can’t perform that action at this time.
0 commit comments