08d958fcf53a3afaf92c4653159d5fb4bd3d1b4e
[dragonfly.git] / usr.bin / awk / patches / run.c.patch
1 diff --git a/contrib/awk20100523/run.c b/contrib/awk20100523/run.c
2 index 88e0f8f..8db0af3 100644
3 --- a/contrib/awk20100523/run.c
4 +++ b/contrib/awk20100523/run.c
5 @@ -1152,13 +1152,13 @@ Cell *cat(Node **a, int q)      /* a[0] cat a[1] */
6         getsval(x);
7         getsval(y);
8         n1 = strlen(x->sval);
9 -       n2 = strlen(y->sval);
10 -       s = (char *) malloc(n1 + n2 + 1);
11 +       n2 = strlen(y->sval) + 1;
12 +       s = (char *) malloc(n1 + n2);
13         if (s == NULL)
14                 FATAL("out of space concatenating %.15s... and %.15s...",
15                         x->sval, y->sval);
16 -       strcpy(s, x->sval);
17 -       strcpy(s+n1, y->sval);
18 +       memmove(s, x->sval, n1);
19 +       memmove(s+n1, y->sval, n2);
20         tempfree(x);
21         tempfree(y);
22         z = gettemp();