summaryrefslogtreecommitdiff
path: root/src/Attrib.c
diff options
context:
space:
mode:
authorAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2004-09-17 08:58:20 +0000
committerAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2004-09-17 08:58:20 +0000
commitc3ba808aef8fcf59b04eb959e9958159648eae8a (patch)
tree398524d47808bbe1dd299f0dee99c0508c88d7af /src/Attrib.c
parent942f06393a915ff354c57d3efae651dca2b3bc75 (diff)
downloadxorg-lib-libXpm-c3ba808aef8fcf59b04eb959e9958159648eae8a.tar.gz
Import XORG-6_8_1 to CYGWIN branchCYGWIN-6_8_1-MERGE
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;