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>
This commit is contained in:
Jim Meyering 2012-10-04 13:09:48 +02:00 committed by Anthony Liguori
parent 3178e2755e
commit d66f8e7bd3
1 changed files with 1 additions and 2 deletions

View File

@ -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]) {