$NetBSD: patch-ba,v 1.1 2004/12/18 00:39:31 tron Exp $ --- lib/Xm/XpmAttrib.c.orig 2000-04-28 16:05:22.000000000 +0100 +++ lib/Xm/XpmAttrib.c 2004-12-17 23:20:38.000000000 +0000 @@ -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,12 +47,15 @@ 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;