tmk: replace overlapping strcpy with memmove - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 154140a22b1c697f6a3edb3e5913efded1be082a
 (DIR) parent 8cb7308f3a24249ed091c7decf22005c64099783
 (HTM) 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:
         M src/cmd/mk/env.c                    |       3 ++-
       
       1 file changed, 2 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/src/cmd/mk/env.c b/src/cmd/mk/env.c
       t@@ -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;