tcsh/tcsh-6.15.00-wide-str.patch

29 lines
771 B
Diff
Raw Normal View History

diff -up tcsh-6.15.00/tc.str.c_old tcsh-6.15.00/tc.str.c
--- tcsh-6.15.00/tc.str.c_old 2008-09-03 13:08:44.000000000 +0200
+++ tcsh-6.15.00/tc.str.c 2008-09-03 13:11:32.000000000 +0200
@@ -154,7 +154,7 @@ short2str(const Char *src)
{
static char *sdst = NULL;
static size_t dstsize = 0;
- char *dst, *edst;
+ char *dst, *edst, *wdst, *wedst;
if (src == NULL)
return (NULL);
@@ -171,8 +171,15 @@ short2str(const Char *src)
if (dst >= edst) {
dstsize += MALLOC_INCR;
sdst = xrealloc(sdst, (dstsize + MALLOC_SURPLUS) * sizeof(char));
+ wdst = dst;
+ wedst = edst;
edst = &sdst[dstsize];
dst = &edst[-MALLOC_INCR];
+ while (wdst > wedst) {
+ dst++;
+ wdst--;
+ }
+
}
}
*dst = 0;