From: Jim Meyering Date: Thu, 4 Oct 2012 11:09:48 +0000 (+0200) Subject: vmdk: relative_path: use pstrcpy in place of strncpy X-Git-Tag: TizenStudio_2.0_p2.3.2~208^2~3417 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d66f8e7bd3de4a2ecf0680c635f870f2138425b8;p=sdk%2Femulator%2Fqemu.git vmdk: relative_path: use pstrcpy in place of strncpy Avoid strncpy+manual-NUL-terminate. Use pstrcpy instead. Acked-by: Kevin Wolf Signed-off-by: Jim Meyering Signed-off-by: Anthony Liguori --- diff --git a/block/vmdk.c b/block/vmdk.c index f2e861b..1a80e5a 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]) {