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

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