summaryrefslogtreecommitdiff
path: root/path.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2008-10-23 04:32:23 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-11-02 06:46:53 (GMT)
commit1442171bc913a9cddae5c6ad0d0a4be3a1ca86e8 (patch)
treec81f4f11de2093f448d196ed53ae246de87bbe23 /path.c
parent421b488a58fea89ceb55d5b358738e9251d44f5e (diff)
downloadgit-1442171bc913a9cddae5c6ad0d0a4be3a1ca86e8.zip
git-1442171bc913a9cddae5c6ad0d0a4be3a1ca86e8.tar.gz
git-1442171bc913a9cddae5c6ad0d0a4be3a1ca86e8.tar.bz2
fix overlapping memcpy in normalize_absolute_path
The comments for normalize_absolute_path explicitly claim that the source and destination buffers may be the same (though they may not otherwise overlap). Thus the call to memcpy may involve copying overlapping data, and memmove should be used instead. This fixes a valgrind error in t1504. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'path.c')
-rw-r--r--path.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/path.c b/path.c
index 76e8872..c1cb54b 100644
--- a/path.c
+++ b/path.c
@@ -348,7 +348,7 @@ int normalize_absolute_path(char *buf, const char *path)
goto next;
}
- memcpy(dst, comp_start, comp_len);
+ memmove(dst, comp_start, comp_len);
dst += comp_len;
next:
comp_start = comp_end;