There's an off-by-one error in this patch. Does the attached patch
work a bit better?
Colin Rafferty <craffert(a)ms.com> writes:
1998-06-05 Colin Rafferty <colin(a)xemacs.org>
* lwlib/xlwmenu.c: Made newchars be as large as it needs to be.
--- lwlib/xlwmenu.c~ Tue Mar 31 15:11:14 1998
+++ lwlib/xlwmenu.c Fri Jun 5 09:42:17 1998
@@ -417,7 +417,8 @@
int drop;
# endif
#endif
- char newchars[64];
+ char* newchars;
+ int charslength;
char *chars;
int i, j;
@@ -429,8 +430,10 @@
#else
chars = string;
#endif
+ charslength = strlen (chars);
+ newchars = (char*) alloca (charslength);
- for (i = j = 0; chars[i] && (j < (int) sizeof
(newchars)); i++)
+ for (i = j = 0; chars[i] && (j < charslength); i++)
if (chars[i]=='%'&&chars[i+1]=='_')
i++;
else
1998-06-07 SL Baur <steve(a)altair.xemacs.org>
* lwlib/xlwmenu.c: Add room for the 0 byte sentinel.
Index: lwlib/xlwmenu.c
===================================================================
RCS file: /usr/local/xemacs/xemacs-20.0/lwlib/xlwmenu.c,v
retrieving revision 1.24
diff -u -r1.24 xlwmenu.c
--- lwlib/xlwmenu.c 1998/03/31 20:11:14 1.24
+++ lwlib/xlwmenu.c 1998/06/07 07:50:10
@@ -417,7 +417,8 @@
int drop;
# endif
#endif
- char newchars[64];
+ char* newchars;
+ int charslength;
char *chars;
int i, j;
@@ -429,8 +430,10 @@
#else
chars = string;
#endif
+ charslength = strlen (chars);
+ newchars = (char *) alloca (charslength + 1);
- for (i = j = 0; chars[i] && (j < (int) sizeof (newchars)); i++)
+ for (i = j = 0; chars[i] && (j < charslength); i++)
if (chars[i]=='%'&&chars[i+1]=='_')
i++;
else