From fe228c5984339a303c88279429ee52e5af58de05 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 10 Apr 2019 09:31:41 +0100 Subject: 44202: Rewrite to use memmove() for possibly overlapping copy --- Src/Zle/compctl.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'Src') diff --git a/Src/Zle/compctl.c b/Src/Zle/compctl.c index fe87409cb..f963d5712 100644 --- a/Src/Zle/compctl.c +++ b/Src/Zle/compctl.c @@ -3331,13 +3331,11 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd) zlemetaline[end] = save; if (brend) { Brinfo bp; - char *p; - int bl; for (bp = brend; bp; bp = bp->next) { - p = lpsuf + (we - zlemetacs) - bp->qpos - - (bl = strlen(bp->str)); - strcpy(p, p + bl); + char *p2 = lpsuf + (we - zlemetacs) - bp->qpos; + char *p1 = p2 - strlen(bp->str); + memmove(p1, p2, strlen(p2) + 1); } } if (!(lpsuf = strchr(lpsuf, '/')) && sf2) -- cgit 1.4.1