diff options
author | Peter Stephenson <p.stephenson@samsung.com> | 2019-04-10 09:31:41 +0100 |
---|---|---|
committer | Peter Stephenson <p.stephenson@samsung.com> | 2019-04-10 09:31:41 +0100 |
commit | fe228c5984339a303c88279429ee52e5af58de05 (patch) | |
tree | 205ffdd32d37ea0cce948ad851b66e5a0d883c8f /Src | |
parent | ba74b16716da3b095e7677d73dfca2bf14008de5 (diff) | |
download | zsh-fe228c5984339a303c88279429ee52e5af58de05.tar.gz zsh-fe228c5984339a303c88279429ee52e5af58de05.tar.xz zsh-fe228c5984339a303c88279429ee52e5af58de05.zip |
44202: Rewrite to use memmove() for possibly overlapping copy
Diffstat (limited to 'Src')
-rw-r--r-- | Src/Zle/compctl.c | 8 |
1 files changed, 3 insertions, 5 deletions
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) |