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 99 *
1010 *
1111 * 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 $
1313 *
1414 *-------------------------------------------------------------------------
1515 */
@@ -1008,8 +1008,14 @@ repeat(PG_FUNCTION_ARGS)
10081008 tlen = (VARHDRSZ + (count * slen ));
10091009
10101010 /* 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+ }
10131019
10141020 result = (text * ) palloc (tlen );
10151021
You can’t perform that action at this time.
0 commit comments