$OpenBSD: patch-lib_Xm_XpmWrFFrI_c,v 1.1 2004/09/01 22:57:36 pvalchev Exp $
--- lib/Xm/XpmWrFFrI.c.orig	Fri Apr 28 09:05:22 2000
+++ lib/Xm/XpmWrFFrI.c	Wed Sep  1 01:31:33 2004
@@ -239,6 +239,8 @@ WritePixels(file, width, height, cpp, pi
     unsigned int x, y, h;
 
     h = height - 1;
+    if (cpp != 0 && width >= (SIZE_MAX - 3)/cpp) 
+	return XpmNoMemory;    
     p = buf = (char *) XpmMalloc(width * cpp + 3);
     if (!buf)
 	return (XpmNoMemory);
