Blame SOURCES/Xaw3d-1.5-debian-fixes.patch

7df9b8
diff -up Xaw3d-1.5libXaw3d-1.6.1/src/AsciiSrc.c.debian Xaw3d-1.5libXaw3d-1.6.1/src/AsciiSrc.c
7df9b8
--- Xaw3d-1.5libXaw3d-1.6.1/src/AsciiSrc.c.debian	2000-11-27 14:19:36.000000000 +0100
7df9b8
+++ Xaw3d-1.5libXaw3d-1.6.1/src/AsciiSrc.c	2008-10-06 11:42:13.000000000 +0200
7df9b8
@@ -51,11 +51,17 @@ in this Software without prior written a
7df9b8
 #include <X11/Xaw3d/MultiSrcP.h> 
7df9b8
 #endif
7df9b8
 
7df9b8
+#include <sys/types.h>
7df9b8
+#include <sys/stat.h>
7df9b8
+#include <fcntl.h>
7df9b8
 
7df9b8
 #if (defined(ASCII_STRING) || defined(ASCII_DISK))
7df9b8
 #  include <X11/Xaw3d/AsciiText.h> /* for Widget Classes. */
7df9b8
 #endif
7df9b8
 
7df9b8
+#include <sys/types.h>
7df9b8
+#include <sys/stat.h>
7df9b8
+#include <fcntl.h>
7df9b8
 
7df9b8
 /****************************************************************
7df9b8
  *
7df9b8
@@ -1007,7 +1013,9 @@ InitStringOrFile(src, newString)
7df9b8
 AsciiSrcObject src;
7df9b8
 Boolean newString;
7df9b8
 {
7df9b8
-    char * open_mode = NULL;
7df9b8
+    mode_t open_mode = 0;
7df9b8
+    const char *fdopen_mode = NULL;
7df9b8
+    int fd;
7df9b8
     FILE * file;
7df9b8
     char fileName[TMPSIZ];
7df9b8
 
7df9b8
@@ -1049,7 +1057,8 @@ Boolean newString;
7df9b8
 	    XtErrorMsg("NoFile", "asciiSourceCreate", "XawError",
7df9b8
 		     "Creating a read only disk widget and no file specified.",
7df9b8
 		       NULL, 0);
7df9b8
-	open_mode = "r";
7df9b8
+	open_mode = O_RDONLY;
7df9b8
+	fdopen_mode = "r";
7df9b8
 	break;
7df9b8
     case XawtextAppend:
7df9b8
     case XawtextEdit:
7df9b8
@@ -1057,9 +1066,17 @@ Boolean newString;
7df9b8
 	    src->ascii_src.string = fileName;
7df9b8
 	    (void) tmpnam(src->ascii_src.string);
7df9b8
 	    src->ascii_src.is_tempfile = TRUE;
7df9b8
-	    open_mode = "w";
7df9b8
-	} else
7df9b8
-	    open_mode = "r+";
7df9b8
+	    open_mode = O_WRONLY | O_CREAT | O_EXCL;
7df9b8
+	    fdopen_mode = "w";
7df9b8
+	} else {
7df9b8
+/* O_NOFOLLOW is a BSD & Linux extension */
7df9b8
+#ifdef O_NOFOLLOW
7df9b8
+		open_mode = O_RDWR | O_NOFOLLOW;
7df9b8
+#else
7df9b8
+		open_mode = O_RDWR; /* unsafe; subject to race conditions */
7df9b8
+#endif
7df9b8
+		fdopen_mode = "r+";
7df9b8
+	}
7df9b8
 	break;
7df9b8
     default:
7df9b8
 	XtErrorMsg("badMode", "asciiSourceCreate", "XawError",
7df9b8
@@ -1078,11 +1095,14 @@ Boolean newString;
7df9b8
     }
7df9b8
     
7df9b8
     if (!src->ascii_src.is_tempfile) {
7df9b8
-	if ((file = fopen(src->ascii_src.string, open_mode)) != 0) {
7df9b8
-	    (void) fseek(file, (Off_t)0, 2);
7df9b8
-	    src->ascii_src.length = (XawTextPosition) ftell(file);
7df9b8
-	    return file;
7df9b8
-	} else {
7df9b8
+	if ((fd = open(src->ascii_src.string, open_mode, 0666))) {
7df9b8
+	    if ((file = fdopen(fd, fdopen_mode)) != NULL) {
7df9b8
+		    (void)fseek(file, 0, SEEK_END);
7df9b8
+		    src->ascii_src.length = (XawTextPosition)ftell(file);
7df9b8
+		    return (file);
7df9b8
+	    }
7df9b8
+	}
7df9b8
+	{	    
7df9b8
 	    String params[2];
7df9b8
 	    Cardinal num_params = 2;
7df9b8
 	    
7df9b8
@@ -1094,7 +1114,7 @@ Boolean newString;
7df9b8
 	}
7df9b8
     } 
7df9b8
     src->ascii_src.length = 0;
7df9b8
-    return((FILE *)NULL);
7df9b8
+    return(NULL);
7df9b8
 }
7df9b8
 
7df9b8
 static void
7df9b8
diff -up Xaw3d-1.5libXaw3d-1.6.1/include/X11/Xaw3d/AsciiSrcP.h.debian Xaw3d-1.5libXaw3d-1.6.1/include/X11/Xaw3d/AsciiSrcP.h
7df9b8
--- Xaw3d-1.5libXaw3d-1.6.1/include/X11/Xaw3d/AsciiSrcP.h.debian	1996-10-15 16:41:18.000000000 +0200
7df9b8
+++ Xaw3d-1.5libXaw3d-1.6.1/include/X11/Xaw3d/AsciiSrcP.h	2008-10-06 11:42:13.000000000 +0200
7df9b8
@@ -85,7 +85,11 @@ SOFTWARE.
7df9b8
 #ifdef L_tmpnam
7df9b8
 #define TMPSIZ L_tmpnam
7df9b8
 #else
7df9b8
-#define TMPSIZ 32		/* bytes to allocate for tmpnam */
7df9b8
+#ifdef PATH_MAX
7df9b8
+#define TMPSIZ PATH_MAX
7df9b8
+#else
7df9b8
+#define TMPSIZ 1024		/* bytes to allocate for tmpnam */
7df9b8
+#endif
7df9b8
 #endif
7df9b8
 
7df9b8
 #define MAGIC_VALUE ((XawTextPosition) -1) /* Magic value. */
7df9b8
diff -up Xaw3d-1.5libXaw3d-1.6.1/src/MenuButton.c.debian Xaw3d-1.5libXaw3d-1.6.1/src/MenuButton.c
7df9b8
--- Xaw3d-1.5libXaw3d-1.6.1/src/MenuButton.c.debian	1996-10-15 16:41:20.000000000 +0200
7df9b8
+++ Xaw3d-1.5libXaw3d-1.6.1/src/MenuButton.c	2008-10-06 11:42:13.000000000 +0200
7df9b8
@@ -53,6 +53,8 @@ in this Software without prior written a
7df9b8
 #include <X11/Xaw3d/XawInit.h>
7df9b8
 #include <X11/Xaw3d/MenuButtoP.h>
7df9b8
 
7df9b8
+#include "XawAlloc.h"
7df9b8
+
7df9b8
 static void ClassInitialize();
7df9b8
 static void PopupMenu();
7df9b8
 
7df9b8
@@ -179,9 +181,16 @@ Cardinal * num_params;
7df9b8
 
7df9b8
   if (menu == NULL) {
7df9b8
     char error_buf[BUFSIZ];
7df9b8
-    (void) sprintf(error_buf, "MenuButton: %s %s.",
7df9b8
-	    "Could not find menu widget named", mbw->menu_button.menu_name);
7df9b8
-    XtAppWarning(XtWidgetToApplicationContext(w), error_buf);
7df9b8
+    char *err1 = "MenuButton: Could not find menu widget named ";
7df9b8
+    char *perr;
7df9b8
+    int len;
7df9b8
+
7df9b8
+    len = strlen(err1) + strlen(mbw->menu_button.menu_name) + 1 + 1;
7df9b8
+    perr = XtStackAlloc(len, error_buf);
7df9b8
+    if (perr == NULL) return;
7df9b8
+    sprintf(perr, "%s%s.", err1, mbw->menu_button.menu_name);
7df9b8
+    XtAppWarning(XtWidgetToApplicationContext(w), perr);
7df9b8
+    XtStackFree(perr, error_buf);
7df9b8
     return;
7df9b8
   }
7df9b8
   if (!XtIsRealized(menu))
7df9b8
diff -up Xaw3d-1.5libXaw3d-1.6.1/src/MultiSrc.c.debian Xaw3d-1.5libXaw3d-1.6.1/src/MultiSrc.c
7df9b8
--- Xaw3d-1.5libXaw3d-1.6.1/src/MultiSrc.c.debian	2008-10-06 11:42:13.000000000 +0200
7df9b8
+++ Xaw3d-1.5libXaw3d-1.6.1/src/MultiSrc.c	2008-10-06 11:42:13.000000000 +0200
7df9b8
@@ -74,6 +74,9 @@ in this Software without prior written a
7df9b8
 #include <stdio.h>
7df9b8
 #include <ctype.h>
7df9b8
 #include <errno.h>
7df9b8
+#include <sys/types.h>
7df9b8
+#include <sys/stat.h>
7df9b8
+#include <fcntl.h>
7df9b8
 
7df9b8
 /****************************************************************
7df9b8
  *
7df9b8
@@ -1077,7 +1080,9 @@ InitStringOrFile(src, newString)
7df9b8
     MultiSrcObject src;
7df9b8
     Boolean newString;
7df9b8
 {
7df9b8
-    char * open_mode = NULL;
7df9b8
+    mode_t open_mode = 0;
7df9b8
+    const char *fdopen_mode = NULL;
7df9b8
+    int fd;
7df9b8
     FILE * file;
7df9b8
     char fileName[TMPSIZ];
7df9b8
     Display *d = XtDisplayOfObject((Widget)src);
7df9b8
@@ -1128,7 +1133,8 @@ InitStringOrFile(src, newString)
7df9b8
 	    XtErrorMsg("NoFile", "multiSourceCreate", "XawError",
7df9b8
 		     "Creating a read only disk widget and no file specified.",
7df9b8
 		       NULL, 0);
7df9b8
-	open_mode = "r";
7df9b8
+	open_mode = O_RDONLY;
7df9b8
+	fdopen_mode = "r";
7df9b8
 	break;
7df9b8
     case XawtextAppend:
7df9b8
     case XawtextEdit:
7df9b8
@@ -1141,9 +1147,17 @@ InitStringOrFile(src, newString)
7df9b8
 
7df9b8
 	    (void) tmpnam(src->multi_src.string);
7df9b8
 	    src->multi_src.is_tempfile = TRUE;
7df9b8
-	    open_mode = "w";
7df9b8
-	} else
7df9b8
-	    open_mode = "r+";
7df9b8
+	    open_mode = O_WRONLY | O_CREAT | O_EXCL;
7df9b8
+	    fdopen_mode = "w";
7df9b8
+	} else {
7df9b8
+/* O_NOFOLLOW is a BSD & Linux extension */
7df9b8
+#ifdef O_NOFOLLOW 
7df9b8
+		open_mode = O_RDWR | O_NOFOLLOW;
7df9b8
+#else
7df9b8
+		open_mode = O_RDWR; /* unsafe; subject to race conditions */
7df9b8
+#endif
7df9b8
+		fdopen_mode = "r+";
7df9b8
+	}
7df9b8
 	break;
7df9b8
     default:
7df9b8
 	XtErrorMsg("badMode", "multiSourceCreate", "XawError",
7df9b8
@@ -1162,11 +1176,14 @@ InitStringOrFile(src, newString)
7df9b8
     }
7df9b8
     
7df9b8
     if (!src->multi_src.is_tempfile) {
7df9b8
-	if ((file = fopen(src->multi_src.string, open_mode)) != 0) {
7df9b8
-	    (void) fseek(file, (Off_t)0, 2);
7df9b8
-            src->multi_src.length = ftell (file);
7df9b8
-	    return file;
7df9b8
-	} else {
7df9b8
+	if ((fd = open(src->multi_src.string, open_mode, 0666))) {
7df9b8
+		if ((file = fdopen(fd, fdopen_mode)) != NULL) {
7df9b8
+			(void)fseek(file, 0, SEEK_END);
7df9b8
+			src->multi_src.length = (XawTextPosition)ftell(file);
7df9b8
+			return (file);
7df9b8
+		}
7df9b8
+	}
7df9b8
+	{
7df9b8
 	    String params[2];
7df9b8
 	    Cardinal num_params = 2;
7df9b8
 	    
7df9b8
@@ -1178,7 +1195,7 @@ InitStringOrFile(src, newString)
7df9b8
 	}
7df9b8
     } 
7df9b8
     src->multi_src.length = 0;
7df9b8
-    return((FILE *)NULL);
7df9b8
+    return(NULL);
7df9b8
 #undef StrLen
7df9b8
 }
7df9b8
 
7df9b8
diff -up Xaw3d-1.5libXaw3d-1.6.1/include/X11/Xaw3d/MultiSrcP.h.debian Xaw3d-1.5libXaw3d-1.6.1/include/X11/Xaw3d/MultiSrcP.h
7df9b8
--- Xaw3d-1.5libXaw3d-1.6.1/include/X11/Xaw3d/MultiSrcP.h.debian	1996-10-15 16:41:21.000000000 +0200
7df9b8
+++ Xaw3d-1.5libXaw3d-1.6.1/include/X11/Xaw3d/MultiSrcP.h	2008-10-06 11:42:13.000000000 +0200
7df9b8
@@ -113,7 +113,11 @@ SOFTWARE.
7df9b8
 #ifdef L_tmpnam
7df9b8
 #define TMPSIZ L_tmpnam
7df9b8
 #else
7df9b8
-#define TMPSIZ 32		/* bytes to allocate for tmpnam */
7df9b8
+#ifdef PATH_MAX
7df9b8
+#define TMPSIZ PATH_MAX
7df9b8
+#else
7df9b8
+#define TMPSIZ 1024		/* bytes to allocate for tmpnam */
7df9b8
+#endif
7df9b8
 #endif
7df9b8
 
7df9b8
 #define MAGIC_VALUE ((XawTextPosition) -1) /* Magic value. */
7df9b8
diff -up Xaw3d-1.5libXaw3d-1.6.1/src/Simple.c.debian Xaw3d-1.5libXaw3d-1.6.1/src/Simple.c
7df9b8
--- Xaw3d-1.5libXaw3d-1.6.1/src/Simple.c.debian	2000-11-27 14:19:36.000000000 +0100
7df9b8
+++ Xaw3d-1.5libXaw3d-1.6.1/src/Simple.c	2008-10-06 11:42:13.000000000 +0200
7df9b8
@@ -56,6 +56,8 @@ SOFTWARE.
7df9b8
 #include <X11/Xaw3d/SimpleP.h>
7df9b8
 #include <X11/Xmu/Drawing.h>
7df9b8
 
7df9b8
+#include "XawAlloc.h"
7df9b8
+
7df9b8
 #define offset(field) XtOffsetOf(SimpleRec, simple.field)
7df9b8
 
7df9b8
 static XtResource resources[] = {
7df9b8
@@ -148,11 +150,17 @@ static void ClassPartInitialize(class)
7df9b8
 
7df9b8
     if (c->simple_class.change_sensitive == NULL) {
7df9b8
 	char buf[BUFSIZ];
7df9b8
-
7df9b8
-	(void) sprintf(buf,
7df9b8
-		"%s Widget: The Simple Widget class method 'change_sensitive' is undefined.\nA function must be defined or inherited.",
7df9b8
-		c->core_class.class_name);
7df9b8
-	XtWarning(buf);
7df9b8
+	char *pbuf;
7df9b8
+	char *msg1 = " Widget: The Simple Widget class method 'change_sensitive' is undefined.\nA function must be defined or inherited.";
7df9b8
+	int len;
7df9b8
+
7df9b8
+	len = strlen(msg1) + strlen(c->core_class.class_name) + 1;
7df9b8
+	pbuf = XtStackAlloc(len, buf);
7df9b8
+	if (pbuf != NULL) {
7df9b8
+	    sprintf(pbuf, "%s%s", c->core_class.class_name, msg1);
7df9b8
+	    XtWarning(pbuf);
7df9b8
+	    XtStackFree(pbuf, buf);
7df9b8
+	}
7df9b8
 	c->simple_class.change_sensitive = ChangeSensitive;
7df9b8
     }
7df9b8
 
7df9b8
diff -up Xaw3d-1.5libXaw3d-1.6.1/src/SimpleMenu.c.debian Xaw3d-1.5libXaw3d-1.6.1/src/SimpleMenu.c
7df9b8
--- Xaw3d-1.5libXaw3d-1.6.1/src/SimpleMenu.c.debian	2003-02-17 07:45:07.000000000 +0100
7df9b8
+++ Xaw3d-1.5libXaw3d-1.6.1/src/SimpleMenu.c	2008-10-06 11:42:13.000000000 +0200
7df9b8
@@ -51,6 +51,8 @@ in this Software without prior written a
7df9b8
 #include <X11/Xmu/Initer.h>
7df9b8
 #include <X11/Xmu/CharSet.h>
7df9b8
 
7df9b8
+#include "XawAlloc.h"
7df9b8
+
7df9b8
 #define streq(a, b)        ( strcmp((a), (b)) == 0 )
7df9b8
 
7df9b8
 #define offset(field) XtOffsetOf(SimpleMenuRec, simple_menu.field)
7df9b8
@@ -755,9 +757,17 @@ Cardinal * num_params;
7df9b8
 
7df9b8
   if ( (menu = FindMenu(w, params[0])) == NULL) {
7df9b8
     char error_buf[BUFSIZ];
7df9b8
-    (void) sprintf(error_buf, "%s '%s'",
7df9b8
-	    "Xaw - SimpleMenuWidget: could not find menu named: ", params[0]);
7df9b8
-    XtAppWarning(XtWidgetToApplicationContext(w), error_buf);
7df9b8
+    char *err1 = "Xaw - SimpleMenuWidget: could not find menu named: ";
7df9b8
+    char *perr;
7df9b8
+    int len;
7df9b8
+
7df9b8
+    len = strlen(err1) + strlen(params[0]) + 2 + 1;
7df9b8
+    perr = XtStackAlloc(len, error_buf);
7df9b8
+    if (perr == NULL)
7df9b8
+	return;
7df9b8
+    sprintf(perr, "%s'%s'", err1, params[0]);
7df9b8
+    XtAppWarning(XtWidgetToApplicationContext(w), perr);
7df9b8
+    XtStackFree(perr, error_buf);
7df9b8
     return;
7df9b8
   }
7df9b8
   
7df9b8
diff -up Xaw3d-1.5libXaw3d-1.6.1/src/StripChart.c.debian Xaw3d-1.5libXaw3d-1.6.1/src/StripChart.c
7df9b8
--- Xaw3d-1.5libXaw3d-1.6.1/src/StripChart.c.debian	2003-02-10 18:18:00.000000000 +0100
7df9b8
+++ Xaw3d-1.5libXaw3d-1.6.1/src/StripChart.c	2008-10-06 11:42:13.000000000 +0200
7df9b8
@@ -315,7 +315,15 @@ XtIntervalId *id;		/* unused */
7df9b8
        if (w->strip_chart.points != NULL) {
7df9b8
 	   w->strip_chart.points[0].x = w->strip_chart.interval + s;
7df9b8
 	   XDrawPoints(XtDisplay(w), XtWindow(w), w->strip_chart.hiGC,
7df9b8
-		       w->strip_chart.points, w->strip_chart.scale,
7df9b8
+		/*
7df9b8
+		 * patch:
7df9b8
+		 *
7df9b8
+		 *     w->strip_chart.points, w->strip_chart.scale,
7df9b8
+		 * 
7df9b8
+		 * this to avoid a subdle bug of extra spurios scan
7df9b8
+		 * line in this widget.
7df9b8
+		 */
7df9b8
+		       w->strip_chart.points, w->strip_chart.scale - 1, 
7df9b8
 		       CoordModePrevious);
7df9b8
        }
7df9b8
 
7df9b8
diff -up Xaw3d-1.5libXaw3d-1.6.1/src/Text.c.debian Xaw3d-1.5libXaw3d-1.6.1/src/Text.c
7df9b8
--- Xaw3d-1.5libXaw3d-1.6.1/src/Text.c.debian	2008-10-06 11:42:13.000000000 +0200
7df9b8
+++ Xaw3d-1.5libXaw3d-1.6.1/src/Text.c	2008-10-06 11:43:16.000000000 +0200
7df9b8
@@ -76,6 +76,8 @@ SOFTWARE.
7df9b8
 #include <ctype.h>		/* for isprint() */
7df9b8
 #include <stdlib.h>
7df9b8
 
7df9b8
+#include "XawAlloc.h"
7df9b8
+
7df9b8
 #ifndef MAX_LEN_CT
7df9b8
 #define MAX_LEN_CT 6		/* for sequence: ESC $ ( A \xx \xx */
7df9b8
 #endif
7df9b8
@@ -521,6 +523,8 @@ Cardinal *num_args;		/* unused */
7df9b8
   TextWidget ctx = (TextWidget) new;
7df9b8
   char error_buf[BUFSIZ];
7df9b8
   int s;
7df9b8
+  char *perr; /* frankie */
7df9b8
+  size_t len; /* frankie */
7df9b8
 
7df9b8
   ctx->text.threeD = XtVaCreateWidget("threeD", threeDWidgetClass, new,
7df9b8
                                  XtNx, 0, XtNy, 0,
7df9b8
@@ -569,10 +573,17 @@ Cardinal *num_args;		/* unused */
7df9b8
   if (ctx->text.scroll_vert != XawtextScrollNever) 
7df9b8
     if ( (ctx->text.resize == XawtextResizeHeight) ||
7df9b8
      	 (ctx->text.resize == XawtextResizeBoth) ) {
7df9b8
-      (void) sprintf(error_buf, "Xaw Text Widget %s:\n %s %s.", ctx->core.name,
7df9b8
-	      "Vertical scrolling not allowed with height resize.\n",
7df9b8
-	      "Vertical scrolling has been DEACTIVATED.");
7df9b8
-      XtAppWarning(XtWidgetToApplicationContext(new), error_buf);
7df9b8
+      char *err1 = "Xaw Text Widget ";
7df9b8
+      char *err2 = ":\nVertical scrolling not allowed with height resize.\n";
7df9b8
+      char *err3 = "Vertical scrolling has been DEACTIVATED.";
7df9b8
+      len = strlen(err1) + strlen(err2) + strlen(err3) +
7df9b8
+		strlen(ctx->core.name) + 1;
7df9b8
+      perr = XtStackAlloc(len, error_buf);
7df9b8
+      if (perr != NULL) {
7df9b8
+	(void) sprintf(perr, "%s%s%s%s", err1, ctx->core.name, err2, err3);
7df9b8
+	XtAppWarning(XtWidgetToApplicationContext(new), perr);
7df9b8
+	XtStackFree(perr, error_buf);
7df9b8
+      }
7df9b8
       ctx->text.scroll_vert = XawtextScrollNever;
7df9b8
     }
7df9b8
     else if (ctx->text.scroll_vert == XawtextScrollAlways)
7df9b8
@@ -580,18 +591,32 @@ Cardinal *num_args;		/* unused */
7df9b8
 
7df9b8
   if (ctx->text.scroll_horiz != XawtextScrollNever) 
7df9b8
     if (ctx->text.wrap != XawtextWrapNever) {
7df9b8
-      (void) sprintf(error_buf, "Xaw Text Widget %s:\n %s %s.", ctx->core.name,
7df9b8
-	      "Horizontal scrolling not allowed with wrapping active.\n",
7df9b8
-	      "Horizontal scrolling has been DEACTIVATED.");
7df9b8
-      XtAppWarning(XtWidgetToApplicationContext(new), error_buf);
7df9b8
+      char *err1 = "Xaw Text Widget ";
7df9b8
+      char *err2 = ":\nHorizontal scrolling not allowed with wrapping active.";
7df9b8
+      char *err3 = "\nHorizontal scrolling has been DEACTIVATED.";
7df9b8
+      len = strlen(err1) + strlen(err2) + strlen(err3) +
7df9b8
+		strlen(ctx->core.name) + 1;
7df9b8
+      perr = XtStackAlloc(len, error_buf);
7df9b8
+      if (perr != NULL) {
7df9b8
+	(void) sprintf(perr, "%s%s%s%s", err1, ctx->core.name, err2, err3);
7df9b8
+	XtAppWarning(XtWidgetToApplicationContext(new), perr);
7df9b8
+	XtStackFree(perr, error_buf);
7df9b8
+      }
7df9b8
       ctx->text.scroll_horiz = XawtextScrollNever;
7df9b8
     }
7df9b8
     else if ( (ctx->text.resize == XawtextResizeWidth) ||
7df9b8
 	      (ctx->text.resize == XawtextResizeBoth) ) {
7df9b8
-      (void) sprintf(error_buf, "Xaw Text Widget %s:\n %s %s.", ctx->core.name,
7df9b8
-	      "Horizontal scrolling not allowed with width resize.\n",
7df9b8
-	      "Horizontal scrolling has been DEACTIVATED.");
7df9b8
-      XtAppWarning(XtWidgetToApplicationContext(new), error_buf);
7df9b8
+      char *err1 = "Xaw Text Widget ";
7df9b8
+      char *err2 = ":\nHorizontal scrolling not allowed with width resize.\n";
7df9b8
+      char *err3 = "Horizontal scrolling has been DEACTIVATED.";
7df9b8
+      len = strlen(err1) + strlen(err2) + strlen(err3) +
7df9b8
+		strlen(ctx->core.name) + 1;
7df9b8
+      perr = XtStackAlloc(len, error_buf);
7df9b8
+      if (perr != NULL) {
7df9b8
+	(void) sprintf(perr, "%s%s%s%s", err1, ctx->core.name, err2, err3);
7df9b8
+	XtAppWarning(XtWidgetToApplicationContext(new), perr);
7df9b8
+	XtStackFree(perr, error_buf);
7df9b8
+      }
7df9b8
       ctx->text.scroll_horiz = XawtextScrollNever;
7df9b8
     }
7df9b8
     else if (ctx->text.scroll_horiz == XawtextScrollAlways)
7df9b8
diff -up Xaw3d-1.5libXaw3d-1.6.1/src/TextPop.c.debian Xaw3d-1.5libXaw3d-1.6.1/src/TextPop.c
7df9b8
--- Xaw3d-1.5libXaw3d-1.6.1/src/TextPop.c.debian	2000-11-27 14:19:36.000000000 +0100
7df9b8
+++ Xaw3d-1.5libXaw3d-1.6.1/src/TextPop.c	2008-10-06 11:42:13.000000000 +0200
7df9b8
@@ -66,6 +66,8 @@ in this Software without prior written a
7df9b8
 #include <X11/Xos.h>		/* for O_RDONLY */
7df9b8
 #include <errno.h>
7df9b8
 
7df9b8
+#include "XawAlloc.h"
7df9b8
+
7df9b8
 #ifdef X_NOT_STDC_ENV
7df9b8
 extern int errno;
7df9b8
 #endif
7df9b8
@@ -809,6 +811,8 @@ DoSearch(search)
7df9b8
 struct SearchAndReplace * search;
7df9b8
 {
7df9b8
   char msg[BUFSIZ];
7df9b8
+  char *pmsg;
7df9b8
+  int len;
7df9b8
   Widget tw = XtParent(search->search_popup);
7df9b8
   XawTextPosition pos;
7df9b8
   XawTextScanDirection dir;
7df9b8
@@ -835,9 +839,20 @@ struct SearchAndReplace * search;
7df9b8
    /* The Raw string in find.ptr may be WC I can't use here, so I re - call 
7df9b8
    GetString to get a tame version. */
7df9b8
 
7df9b8
-  if (pos == XawTextSearchError) 
7df9b8
-    (void) sprintf( msg, "Could not find string ``%s''.", GetString( search->search_text ) );
7df9b8
-  else {
7df9b8
+  if (pos == XawTextSearchError) {
7df9b8
+    char *msg1 = "Could not find string ``";
7df9b8
+    char *msg2 = "''.";
7df9b8
+    len = strlen(msg1) + strlen(msg2) +
7df9b8
+		strlen(GetString( search->search_text )) + 1;
7df9b8
+    pmsg = XtStackAlloc(len, msg);
7df9b8
+    if (pmsg != NULL) {
7df9b8
+      (void) sprintf( pmsg, "%s%s%s", msg1, GetString( search->search_text ),
7df9b8
+			msg2);
7df9b8
+    } else {
7df9b8
+      pmsg = msg;
7df9b8
+      (void) sprintf( pmsg, "Could not find string");
7df9b8
+    }
7df9b8
+  } else {
7df9b8
     if (dir == XawsdRight)
7df9b8
       XawTextSetInsertionPoint( tw, pos + text.length);
7df9b8
     else
7df9b8
@@ -849,7 +864,8 @@ struct SearchAndReplace * search;
7df9b8
   }
7df9b8
   
7df9b8
   XawTextUnsetSelection(tw);
7df9b8
-  SetSearchLabels(search, msg, "", TRUE);
7df9b8
+  SetSearchLabels(search, pmsg, "", TRUE);
7df9b8
+  XtStackFree(pmsg, msg);
7df9b8
   return(FALSE);
7df9b8
 }
7df9b8
 
7df9b8
@@ -982,13 +998,26 @@ Boolean once_only, show_current;
7df9b8
       if ( (new_pos == XawTextSearchError) ) {
7df9b8
 	if (count == 0) {
7df9b8
 	  char msg[BUFSIZ];
7df9b8
+	  char *pmsg;
7df9b8
+	  int len;
7df9b8
+	  char *msg1 = "*** Error: Could not find string ``";
7df9b8
+	  char *msg2 = "''. ***";
7df9b8
 
7df9b8
              /* The Raw string in find.ptr may be WC I can't use here, 
7df9b8
 		so I call GetString to get a tame version.*/
7df9b8
 
7df9b8
-	  (void) sprintf( msg, "%s %s %s", "*** Error: Could not find string ``",
7df9b8
-		  GetString( search->search_text ), "''. ***");
7df9b8
-	  SetSearchLabels(search, msg, "", TRUE);
7df9b8
+	  len = strlen(msg1) + strlen(msg2) +
7df9b8
+		strlen(GetString( search->search_text )) + 1;
7df9b8
+	  pmsg = XtStackAlloc(len, msg);
7df9b8
+	  if (pmsg != NULL) {
7df9b8
+	    (void) sprintf( pmsg, "%s%s%s", msg1,
7df9b8
+				GetString( search->search_text ), msg2);
7df9b8
+	  } else {
7df9b8
+	    pmsg = msg;
7df9b8
+	    (void) sprintf(pmsg, "*** Error: Could not find string ***");
7df9b8
+	  }
7df9b8
+	  SetSearchLabels(search, pmsg, "", TRUE);
7df9b8
+	  XtStackFree(pmsg, msg);
7df9b8
 	  return(FALSE);
7df9b8
 	}
7df9b8
 	else
7df9b8
@@ -1011,9 +1040,22 @@ Boolean once_only, show_current;
7df9b8
 
7df9b8
     if (XawTextReplace(tw, pos, end_pos, &replace) != XawEditDone) {
7df9b8
       char msg[BUFSIZ];
7df9b8
-      
7df9b8
-      (void) sprintf( msg, "'%s' with '%s'. ***", find.ptr, replace.ptr);
7df9b8
+      char *pmsg;
7df9b8
+      int len;
7df9b8
+      char *msg1 = "' with '";
7df9b8
+      char *msg2 = "'. ***";
7df9b8
+
7df9b8
+      len = 1 + strlen(msg1) + strlen(msg2) + strlen(find.ptr) +
7df9b8
+		strlen(replace.ptr) + 1;
7df9b8
+      pmsg = XtStackAlloc(len, msg);
7df9b8
+      if (pmsg != NULL) {
7df9b8
+	(void) sprintf( pmsg, "`%s%s%s%s", find.ptr, msg1, replace.ptr, msg2);
7df9b8
+      } else {
7df9b8
+	pmsg = msg;
7df9b8
+	(void) sprintf(pmsg, "string ***");
7df9b8
+      }
7df9b8
       SetSearchLabels(search, "*** Error while replacing", msg, TRUE);
7df9b8
+      XtStackFree(pmsg, msg);
7df9b8
       return(FALSE);
7df9b8
     }      
7df9b8
 
7df9b8
@@ -1164,13 +1206,20 @@ XtArgVal value;
7df9b8
 {
7df9b8
   Widget temp_widget;
7df9b8
   char buf[BUFSIZ];
7df9b8
+  char *pbuf;
7df9b8
+  int len;
7df9b8
 
7df9b8
-  (void) sprintf(buf, "%s.%s", FORM_NAME, name);
7df9b8
+  len = strlen(FORM_NAME) + strlen(name) + 2;
7df9b8
+  pbuf = XtStackAlloc(len, buf);
7df9b8
+  if (pbuf == NULL) return FALSE;
7df9b8
+  (void) sprintf(pbuf, "%s.%s", FORM_NAME, name);
7df9b8
 
7df9b8
-  if ( (temp_widget = XtNameToWidget(shell, buf)) != NULL) {
7df9b8
+  if ( (temp_widget = XtNameToWidget(shell, pbuf)) != NULL) {
7df9b8
     SetResource(temp_widget, res_name, value);
7df9b8
+    XtStackFree(pbuf, buf);
7df9b8
     return(TRUE);
7df9b8
   }
7df9b8
+  XtStackFree(pbuf, buf);
7df9b8
   return(FALSE);
7df9b8
 }
7df9b8
 
7df9b8
diff -up /dev/null Xaw3d-1.5libXaw3d-1.6.1/include/X11/Xaw3d/XawAlloc.h
7df9b8
--- /dev/null	2008-10-06 08:37:32.418005377 +0200
7df9b8
+++ Xaw3d-1.5libXaw3d-1.6.1/include/X11/Xaw3d/XawAlloc.h	2008-10-06 11:42:13.000000000 +0200
7df9b8
@@ -0,0 +1,10 @@
7df9b8
+/* $XFree86: xc/lib/Xaw/XawAlloc.h,v 1.1.2.1 1998/05/16 09:05:23 dawes Exp $ */
7df9b8
+
7df9b8
+#define XtStackAlloc(size, stack_cache_array)     \
7df9b8
+    ((size) <= sizeof(stack_cache_array)          \
7df9b8
+    ?  (XtPointer)(stack_cache_array)             \
7df9b8
+    :  XtMalloc((unsigned)(size)))
7df9b8
+     
7df9b8
+#define XtStackFree(pointer, stack_cache_array) \
7df9b8
+    if ((pointer) != ((XtPointer)(stack_cache_array))) XtFree(pointer); else
7df9b8
+
7df9b8
--- xaw3d-1.5libXaw3d-1.6.1/src/SmeBSB.c	2003-08-04 17:27:58.000000000 +0200
7df9b8
+++ xaw3d-1.5libXaw3d-1.6.1/src/SmeBSB.c	2003-08-07 15:02:39.000000000 +0200
7df9b8
@@ -52,6 +52,8 @@
7df9b8
 #include <X11/Xaw3d/Cardinals.h>
7df9b8
 #include <stdio.h>
7df9b8
 
7df9b8
+#include "XawAlloc.h"
7df9b8
+
7df9b8
 /* needed for abs() */
7df9b8
 #ifndef X_NOT_STDC_ENV
7df9b8
 #include <stdlib.h>
7df9b8
@@ -712,6 +714,8 @@
7df9b8
     int x, y;
7df9b8
     unsigned int width, height, bw;
7df9b8
     char buf[BUFSIZ];
7df9b8
+    char *pbuf;
7df9b8
+    int len;
7df9b8
     
7df9b8
     if (is_left) {
7df9b8
 	width = height = 0;
7df9b8
@@ -720,18 +724,24 @@
7df9b8
 	    if (!XGetGeometry(XtDisplayOfObject(w), 
7df9b8
 			    entry->sme_bsb.left_bitmap, &root, &x, &y,
7df9b8
 			    &width, &height, &bw, &entry->sme_bsb.left_depth)) {
7df9b8
-		(void) sprintf(buf, "Xaw SmeBSB Object: %s %s \"%s\".",
7df9b8
-			"Could not get Left Bitmap",
7df9b8
-			"geometry information for menu entry",
7df9b8
-			XtName(w));
7df9b8
-		XtAppError(XtWidgetToApplicationContext(w), buf);
7df9b8
+               char *err1 = "Xaw SmeBSB Object: Could not get Left Bitmap geometry information for menu entry ";
7df9b8
+	       len = strlen(err1) + strlen(XtName(w)) + 3 + 1;
7df9b8
+               pbuf = XtStackAlloc(len, buf);
7df9b8
+               if (pbuf == NULL) return;
7df9b8
+               sprintf(pbuf, "%s\"%s\".", err1, XtName(w));
7df9b8
+               XtAppError(XtWidgetToApplicationContext(w), pbuf);
7df9b8
+               XtStackFree(pbuf, buf);
7df9b8
 	    }
7df9b8
 #ifdef NEVER
7df9b8
 	    if (entry->sme_bsb.left_depth != 1) {
7df9b8
-		(void) sprintf(buf, "Xaw SmeBSB Object: %s \"%s\" %s.", 
7df9b8
-			"Left Bitmap of entry",  XtName(w),
7df9b8
-			"is not one bit deep");
7df9b8
-		XtAppError(XtWidgetToApplicationContext(w), buf);
7df9b8
+               char *err1 = "Xaw SmeBSB Object: Left Bitmap of entry ";
7df9b8
+               char *err2 = " is not one bit deep.";
7df9b8
+               len = strlen(err1) + strlen(err2) + strlen(XtName(w)) + 2 + 1;
7df9b8
+               pbuf = XtStackAlloc(len, buf);
7df9b8
+               if (pbuf == NULL) return;
7df9b8
+               sprintf(pbuf, "%s\"%s\"%s", err1, XtName(w), err2);
7df9b8
+               XtAppError(XtWidgetToApplicationContext(w), pbuf);
7df9b8
+               XtStackFree(pbuf, buf);
7df9b8
 	    }
7df9b8
 #endif
7df9b8
 	}
7df9b8
@@ -745,18 +755,24 @@
7df9b8
 	    if (!XGetGeometry(XtDisplayOfObject(w),
7df9b8
 			    entry->sme_bsb.right_bitmap, &root, &x, &y,
7df9b8
 			    &width, &height, &bw, &entry->sme_bsb.right_depth)) {
7df9b8
-		(void) sprintf(buf, "Xaw SmeBSB Object: %s %s \"%s\".",
7df9b8
-			"Could not get Right Bitmap",
7df9b8
-			"geometry information for menu entry",
7df9b8
-			XtName(w));
7df9b8
-		XtAppError(XtWidgetToApplicationContext(w), buf);
7df9b8
+            char *err1 = "Xaw SmeBSB Object: Could not get Right Bitmap geometry information for menu entry ";
7df9b8
+            len = strlen(err1) + strlen(XtName(w)) + 3 + 1;
7df9b8
+            pbuf = XtStackAlloc(len, buf);
7df9b8
+            if (pbuf == NULL) return;
7df9b8
+            sprintf(pbuf, "%s\"%s\".", err1, XtName(w));
7df9b8
+            XtAppError(XtWidgetToApplicationContext(w), pbuf);
7df9b8
+            XtStackFree(pbuf, buf);
7df9b8
 	    }
7df9b8
 #ifdef NEVER
7df9b8
 	    if (entry->sme_bsb.right_depth != 1) {
7df9b8
-		(void) sprintf(buf, "Xaw SmeBSB Object: %s \"%s\" %s.", 
7df9b8
-			"Right Bitmap of entry", XtName(w),
7df9b8
-			"is not one bit deep");
7df9b8
-		XtAppError(XtWidgetToApplicationContext(w), buf);
7df9b8
+            char *err1 = "Xaw SmeBSB Object: Right Bitmap of entry ";
7df9b8
+            char *err2 = " is not one bit deep.";
7df9b8
+            len = strlen(err1) + strlen(err2) + strlen(XtName(w)) + 2 + 1;
7df9b8
+            pbuf = XtStackAlloc(len, buf);
7df9b8
+            if (pbuf == NULL) return;
7df9b8
+            sprintf(pbuf, "%s\"%s\"%s", err1, XtName(w), err2);
7df9b8
+            XtAppError(XtWidgetToApplicationContext(w), pbuf);
7df9b8
+            XtStackFree(pbuf, buf);
7df9b8
 	    }
7df9b8
 #endif
7df9b8
 	}