aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2009-04-14 01:43:56 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2009-04-14 01:43:56 +0000
commitc230dbdc60fc16e59a6b8cb9b893b5162db368b8 (patch)
tree6f6bd1930c4b70e097d7c131815f7d61b364bc87 /packages
parent5febd12b6d5d80702b285427acc4c562fc339e8a (diff)
fixed crasher bug #2030557 caused by % in GUI labels. So it turns out that BSD's sprintf() isn't as fault-tolerant as GNU's. It was crashing on unescaped %, I guess it was trying to replace them and failing miserably. This patch fixes it by only running the first % pattern thru the sprintf() then just copying the rest before sending it to sys_gui();
svn path=/trunk/; revision=11017
Diffstat (limited to 'packages')
-rw-r--r--packages/patches/fix_gui_%_crash-0.42-4.patch29
1 files changed, 29 insertions, 0 deletions
diff --git a/packages/patches/fix_gui_%_crash-0.42-4.patch b/packages/patches/fix_gui_%_crash-0.42-4.patch
new file mode 100644
index 00000000..02c39313
--- /dev/null
+++ b/packages/patches/fix_gui_%_crash-0.42-4.patch
@@ -0,0 +1,29 @@
+Index: x_gui.c
+===================================================================
+--- x_gui.c (revision 11016)
++++ x_gui.c (working copy)
+@@ -49,6 +49,9 @@
+ {
+ char buf[4*MAXPDSTRING];
+ char namebuf[80];
++ char sprintfbuf[MAXPDSTRING];
++ char *afterpercent;
++ t_int afterpercentlen;
+ t_gfxstub *x;
+ t_symbol *s;
+ /* if any exists with matching key, burn it. */
+@@ -71,7 +74,13 @@
+ x->x_key = key;
+ x->x_next = gfxstub_list;
+ gfxstub_list = x;
+- sprintf(buf, cmd, s->s_name);
++ /* only replace first %s so sprintf() doesn't crash */
++ afterpercent = strchr(cmd, '%') + 2;
++ afterpercentlen = afterpercent - cmd;
++ strncpy(sprintfbuf, cmd, afterpercentlen);
++ sprintfbuf[afterpercentlen] = '\0';
++ sprintf(buf, sprintfbuf, s->s_name);
++ strncat(buf, afterpercent, (4*MAXPDSTRING) - afterpercentlen);
+ sys_gui(buf);
+ }
+