From 9c570af3330f1c59b9eb5a47139d6753a1d292e8 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 3 Sep 2003 00:56:43 +0000 Subject: Fix up overlapping memcpy -> memmove found by valgrind. Jeremy. (This used to be commit e0c1460c6b6af2b83ea205d8abeb37c71ca1d4c1) --- source3/lib/util_str.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index c356fdcab7..f036d88da0 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -428,7 +428,9 @@ BOOL trim_string(char *s,const char *front,const char *back) if (front_len) { while (len && strncmp(s, front, front_len)==0) { - memcpy(s, s+front_len, (len-front_len)+1); + /* Must use memmove here as src & dest can + * easily overlap. Found by valgrind. JRA. */ + memmove(s, s+front_len, (len-front_len)+1); len -= front_len; ret=True; } -- cgit