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

29 lines
915 B
Plaintext

$OpenBSD: patch-lib_Xm_XpmAttrib_c,v 1.1 2004/09/01 22:57:36 pvalchev Exp $
--- lib/Xm/XpmAttrib.c.orig Fri Apr 28 09:05:22 2000
+++ lib/Xm/XpmAttrib.c Wed Sep 1 01:31:33 2004
@@ -36,7 +36,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));
@@ -47,11 +47,14 @@ LFUNC(FreeOldColorTable, void, (XpmColor
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) {