$OpenBSD: patch-src_gui_image_qxbmhandler_cpp,v 1.2 2005/09/19 20:40:16 espie Exp $
--- src/gui/image/qxbmhandler.cpp.orig	Tue Aug 16 10:41:11 2005
+++ src/gui/image/qxbmhandler.cpp	Sun Sep 18 15:45:40 2005
@@ -141,7 +141,8 @@ static bool write_xbm_image(const QImage
     int	       h = image.height();
     int	       i;
     QString    s = fileName; // get file base name
-    char *buf = new char[s.length() + 100];
+    int	       sz = s.length() + 100;
+    char *buf = new char[sz];
 
 #if defined(_MSC_VER) && _MSC_VER >= 1400
 	sprintf_s(buf, s.length() + 100, "#define %s_width %d\n", s.toAscii().data(), w);
@@ -150,11 +151,11 @@ static bool write_xbm_image(const QImage
     device->write(buf, qstrlen(buf));
     sprintf_s(buf, s.length() + 100, "static char %s_bits[] = {\n ", s.toAscii().data());
 #else
-	sprintf(buf, "#define %s_width %d\n", s.toAscii().data(), w);
+    snprintf(buf, sz, "#define %s_width %d\n", s.toAscii().data(), w);
     device->write(buf, qstrlen(buf));
-    sprintf(buf, "#define %s_height %d\n", s.toAscii().data(), h);
+    snprintf(buf, sz, "#define %s_height %d\n", s.toAscii().data(), h);
     device->write(buf, qstrlen(buf));
-    sprintf(buf, "static char %s_bits[] = {\n ", s.toAscii().data());
+    snprintf(buf, sz, "static char %s_bits[] = {\n ", s.toAscii().data());
 #endif
     device->write(buf, qstrlen(buf));
 
