aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--osx.m11
1 files changed, 6 insertions, 5 deletions
diff --git a/osx.m b/osx.m
index b59999d..6e709a5 100644
--- a/osx.m
+++ b/osx.m
@@ -1088,15 +1088,16 @@ struct frontend {
p = i->sval;
c = *p++;
while (*p) {
- char cc, *q;
+ char *q, *copy;
q = p;
while (*p && *p != c) p++;
- cc = *p;
- *p = '\0';
- [pb addItemWithTitle:[NSString stringWithUTF8String:q]];
- *p = cc;
+ copy = snewn((p-q) + 1, char);
+ memcpy(copy, q, p-q);
+ copy[p-q] = '\0';
+ [pb addItemWithTitle:[NSString stringWithUTF8String:copy]];
+ sfree(copy);
if (*p) p++;
}