summaryrefslogtreecommitdiff
path: root/src/Attrib.c
diff options
context:
space:
mode:
authorRoland Mainz <roland.mainz@nrubsig.org>2004-12-17 01:09:36 +0000
committerRoland Mainz <roland.mainz@nrubsig.org>2004-12-17 01:09:36 +0000
commit53b0a7a28aa06e69bdc27c2d51e7f1d9c917c866 (patch)
tree291a1323facfbc4a8076ab50d808786fe64e7772 /src/Attrib.c
parent49bb0a3ec1d9b781ec1d8a9fa21934979ddfc6a9 (diff)
xc/extras/Xpm/lib/Attrib.c xc/extras/Xpm/lib/CrBufFrI.c xc/extras/Xpm/lib/CrDatFrI.c xc/extras/Xpm/lib/RdFToBuf.c xc/extras/Xpm/lib/RdFToI.c xc/extras/Xpm/lib/WrFFrBuf.c xc/extras/Xpm/lib/WrFFrI.c xc/extras/Xpm/lib/XpmI.h xc/extras/Xpm/lib/create.c xc/extras/Xpm/lib/data.c xc/extras/Xpm/lib/hashtab.c xc/extras/Xpm/lib/misc.c xc/extras/Xpm/lib/parse.c //bugs.freedesktop.org/show_bug.cgi?id=1920) attachment #1514 (https://bugs.freedesktop.org/attachment.cgi?id=1514): libXpm security fixes for CAN-2004-0914. Patch by Thomas Biege.
Diffstat (limited to 'src/Attrib.c')
-rw-r--r--src/Attrib.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/Attrib.c b/src/Attrib.c
index cf7081c..028c2cb 100644
--- a/src/Attrib.c
+++ b/src/Attrib.c
@@ -32,13 +32,15 @@
* Developed by Arnaud Le Hors *
\*****************************************************************************/
+/* October 2004, source code review by Thomas Biege <thomas@suse.de> */
+
#include "XpmI.h"
/* 3.2 backward compatibility code */
LFUNC(CreateOldColorTable, int, (XpmColor *ct, unsigned int ncolors,
XpmColor ***oldct));
-LFUNC(FreeOldColorTable, void, (XpmColor **colorTable, int ncolors));
+LFUNC(FreeOldColorTable, void, (XpmColor **colorTable, unsigned int ncolors));
/*
* Create a colortable compatible with the old style colortable
@@ -50,9 +52,9 @@ CreateOldColorTable(ct, ncolors, oldct)
XpmColor ***oldct;
{
XpmColor **colorTable, **color;
- int a;
+ unsigned int a;
- if (ncolors >= SIZE_MAX / sizeof(XpmColor *))
+ if (ncolors >= UINT_MAX / sizeof(XpmColor *))
return XpmNoMemory;
colorTable = (XpmColor **) XpmMalloc(ncolors * sizeof(XpmColor *));
@@ -69,9 +71,9 @@ CreateOldColorTable(ct, ncolors, oldct)
static void
FreeOldColorTable(colorTable, ncolors)
XpmColor **colorTable;
- int ncolors;
+ unsigned int ncolors;
{
- int a, b;
+ unsigned int a, b;
XpmColor **color;
char **sptr;
@@ -122,7 +124,7 @@ XpmFreeExtensions(extensions, nextensions)
XpmExtension *ext;
char **sptr;
- if (extensions) {
+ if (extensions && nextensions > 0) {
for (i = 0, ext = extensions; i < nextensions; i++, ext++) {
if (ext->name)
XpmFree(ext->name);