commit 154140a22b1c697f6a3edb3e5913efded1be082a
parent 8cb7308f3a24249ed091c7decf22005c64099783
Author: Russ Cox <rsc@swtch.com>
Date: Sun, 17 May 2020 20:06:31 -0400
mk: replace overlapping strcpy with memmove
Found by ASAN.
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/cmd/mk/env.c b/src/cmd/mk/env.c
@@ -123,7 +123,8 @@ buildenv(Job *j, int slot)
qp = strchr(cp+1, ')');
if(qp){
*qp = 0;
- strcpy(w->s, cp+1);
+ /* strcpy, but might overlap */
+ memmove(w->s, cp+1, strlen(cp+1)+1);
l = &w->next;
w = w->next;
continue;