diff --git a/src/cmd/ksh93/edit/history.c b/src/cmd/ksh93/edit/history.c index 191f3469c..7d50ee072 100644 --- a/src/cmd/ksh93/edit/history.c +++ b/src/cmd/ksh93/edit/history.c @@ -1115,7 +1115,8 @@ char *hist_word(char *string,int size,int word) } *cp = 0; if(s1 != string) - strcpy(string,s1); + /* We can't use strcpy() because the two buffers may overlap. */ + memmove(string,s1,strlen(s1)+1); return(string); }