summaryrefslogtreecommitdiff
path: root/src/Attrib.c
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2004-09-15 15:47:39 +0000
committerDaniel Stone <daniel@fooishbar.org>2004-09-15 15:47:39 +0000
commit19066719975d0dbfa51c6b413a3760ed7cf93ddc (patch)
treec757de7bbe7881acf219c1f4bf0b3459fbd8cd84 /src/Attrib.c
parent2773a7214e282f6f673483f5233b880505947c3f (diff)
Merge patch from Mathieu Herrb to fix several integer overflows and otherXORG-6_8_1
security errors in libXpm.
Diffstat (limited to 'src/Attrib.c')
-rw-r--r--src/Attrib.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Attrib.c b/src/Attrib.c
index 04b843b..cf7081c 100644
--- a/src/Attrib.c
+++ b/src/Attrib.c
@@ -35,7 +35,7 @@
#include "XpmI.h"
/* 3.2 backward compatibility code */
-LFUNC(CreateOldColorTable, int, (XpmColor *ct, int ncolors,
+LFUNC(CreateOldColorTable, int, (XpmColor *ct, unsigned int ncolors,
XpmColor ***oldct));
LFUNC(FreeOldColorTable, void, (XpmColor **colorTable, int ncolors));
@@ -46,12 +46,15 @@ LFUNC(FreeOldColorTable, void, (XpmColor **colorTable, int ncolors));
static int
CreateOldColorTable(ct, ncolors, oldct)
XpmColor *ct;
- int ncolors;
+ unsigned int ncolors;
XpmColor ***oldct;
{
XpmColor **colorTable, **color;
int a;
+ if (ncolors >= SIZE_MAX / sizeof(XpmColor *))
+ return XpmNoMemory;
+
colorTable = (XpmColor **) XpmMalloc(ncolors * sizeof(XpmColor *));
if (!colorTable) {
*oldct = NULL;