summaryrefslogtreecommitdiff
path: root/source3/lib/util_str.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib/util_str.c')
-rw-r--r--source3/lib/util_str.c4
1 files changed, 3 insertions, 1 deletions
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;
}