summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2011-03-05 13:58:47 +0200
committerVicent Marti <tanoku@gmail.com>2011-03-05 13:58:47 +0200
commit246eba80af31d25a1fb14e707f79374cf91f8bb7 (patch)
treeee1fa6e084c2ca9eccb82d55b3493a80511d4c64
parent60cb1d10b3eb0e7966be1c40501524dc10e4c512 (diff)
downloadlibgit2-246eba80af31d25a1fb14e707f79374cf91f8bb7.tar.gz
Use memmove() in git__dirname and git__basename
We cannot make sure that the user doesn't use the same buffer as source and destination, so write to it using memmove. Signed-off-by: Vicent Marti <tanoku@gmail.com>
-rw-r--r--src/util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util.c b/src/util.c
index d23ae4c3f..c9a8e5fe9 100644
--- a/src/util.c
+++ b/src/util.c
@@ -82,7 +82,7 @@ Exit:
}
if (len >= 0) {
- memcpy(buffer, startp, len);
+ memmove(buffer, startp, len);
buffer[len] = 0;
}
return result;
@@ -140,7 +140,7 @@ Exit:
}
if (len >= 0) {
- memcpy(buffer, path, len);
+ memmove(buffer, path, len);
buffer[len] = 0;
}
return result;