openbsd-ports/x11/openmotif/patches/patch-lib_Xm_Xpmhashtab_c
2004-09-01 22:57:36 +00:00

31 lines
1.1 KiB
Plaintext

$OpenBSD: patch-lib_Xm_Xpmhashtab_c,v 1.1 2004/09/01 22:57:36 pvalchev Exp $
--- lib/Xm/Xpmhashtab.c.orig Fri Apr 28 09:05:22 2000
+++ lib/Xm/Xpmhashtab.c Wed Sep 1 01:31:33 2004
@@ -136,7 +136,7 @@ HashTableGrows(table)
xpmHashTable *table;
{
xpmHashAtom *atomTable = table->atomTable;
- int size = table->size;
+ unsigned int size = table->size;
xpmHashAtom *t, *p;
int i;
int oldSize = size;
@@ -145,6 +145,8 @@ HashTableGrows(table)
HASH_TABLE_GROWS
table->size = size;
table->limit = size / 3;
+ if (size >= SIZE_MAX / sizeof(*atomTable))
+ return (XpmNoMemory);
atomTable = (xpmHashAtom *) XpmMalloc(size * sizeof(*atomTable));
if (!atomTable)
return (XpmNoMemory);
@@ -205,6 +207,8 @@ xpmHashTableInit(table)
table->size = INITIAL_HASH_SIZE;
table->limit = table->size / 3;
table->used = 0;
+ if (table->size >= SIZE_MAX / sizeof(*atomTable))
+ return (XpmNoMemory);
atomTable = (xpmHashAtom *) XpmMalloc(table->size * sizeof(*atomTable));
if (!atomTable)
return (XpmNoMemory);