memmove not memcpy, src/dst overlap
This commit is contained in:
parent
65a3713605
commit
09bda13970
4
eval.c
4
eval.c
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.78 2009/12/05 17:43:45 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.79 2009/12/05 22:24:35 tg Exp $");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* string expansion
|
* string expansion
|
||||||
@ -1364,7 +1364,7 @@ debunk(char *dp, const char *sp, size_t dlen)
|
|||||||
if ((s = cstrchr(sp, MAGIC))) {
|
if ((s = cstrchr(sp, MAGIC))) {
|
||||||
if (s - sp >= (ssize_t)dlen)
|
if (s - sp >= (ssize_t)dlen)
|
||||||
return (dp);
|
return (dp);
|
||||||
memcpy(dp, sp, s - sp);
|
memmove(dp, sp, s - sp);
|
||||||
for (d = dp + (s - sp); *s && (d - dp < (ssize_t)dlen); s++)
|
for (d = dp + (s - sp); *s && (d - dp < (ssize_t)dlen); s++)
|
||||||
if (!ISMAGIC(*s) || !(*++s & 0x80) ||
|
if (!ISMAGIC(*s) || !(*++s & 0x80) ||
|
||||||
!vstrchr("*+?@! ", *s & 0x7f))
|
!vstrchr("*+?@! ", *s & 0x7f))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user