Subject: Notification: incoming/745

From: [email-masked]
Date: Mon, 23 Jul 2001 23:05:46 -0500

FVWM Bug Tracking notification

new message incoming/745

Message summary for PR#745
	From: [email-masked]
	Subject: FvwmForm's "message" displays null chars
	Date: Mon, 23 Jul 2001 23:05:45 -0500
	0 replies 	0 followups

====> ORIGINAL MESSAGE FOLLOWS <====

>From [email-masked] Mon Jul 23 23:05:46 2001
From: [email-masked]
To: [email-masked]
Subject: FvwmForm's "message" displays null chars
Date: Mon, 23 Jul 2001 23:05:45 -0500

Full_Name: Dmitry Bolkhovityanov
Version: 2.4
CVS_Date: 20010705
OS: Red Hat Linux 7.1
X_Server: XFree86 4.0.3
Submission from: (NULL) (140.221.9.192)

FvwmForm's "message" displays null chars after a message itself.  While it
was okay in older environments ('\0's were empty glyphs), in most modern
fonts null chars are either present or displayed because of present
DEFAULT_CHAR (usually a solid or dashed rectangle).

To reproduce: under XFree86 >=4.0.3, start FvwmTalk and issue some bad
command -- like "aaa".  The error message will be padded with rectangles.

A simple patch to fix it (hope FvwmBug wouldn't mangle the text ;-):

---- CUT ----
--- modules/FvwmForm/FvwmForm.c.orig    Sun Mar 25 04:44:12 2001
+++ modules/FvwmForm/FvwmForm.c Tue Jul 24 09:46:16 2001
@@ -1169,13 +1169,18 @@
 void RedrawText(Item *item)
 {
   int x, y;
+  int len;
+  char *p;
   CheckAlloc(item,item->header.dt_ptr); /* alloc colors and fonts needed
*/
   x = item->header.pos_x + TEXT_SPC;
   y = item->header.pos_y + ( CF.padVText / 2 ) +
     item->header.dt_ptr->dt_font_struct->ascent;
+  len = item->text.n;
+  if ((p = memchr(item->text.value, '\0', len)) != NULL)
+    len = p - item->text.value;
   XDrawString(dpy, CF.frame, item->header.dt_ptr->dt_GC,
                    x, y, item->text.value,
-                   item->text.n);
+                   len);
 }
 
 /* redraw an item */
---- CUT ----

BTW, this goof is fairly common (it became visible in many apps under
4.0.3), so other pieces of FVWM are worth checking.

--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]