aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2012-10-04 13:09:48 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2012-10-05 07:58:36 -0500
commitd66f8e7bd3de4a2ecf0680c635f870f2138425b8 (patch)
treecbca695676fd55f235d66ff6fd329fc4330631f5 /block
parent3178e2755ec5a7fb1afe583fb6ac2622c2c42184 (diff)
vmdk: relative_path: use pstrcpy in place of strncpy
Avoid strncpy+manual-NUL-terminate. Use pstrcpy instead. Acked-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'block')
-rw-r--r--block/vmdk.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/block/vmdk.c b/block/vmdk.c
index f2e861b074..1a80e5a247 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1408,8 +1408,7 @@ static int relative_path(char *dest, int dest_size,
return -1;
}
if (path_is_absolute(target)) {
- dest[dest_size - 1] = '\0';
- strncpy(dest, target, dest_size - 1);
+ pstrcpy(dest, dest_size, target);
return 0;
}
while (base[i] == target[i]) {