Skip to content

Commit

Permalink
vmdk: relative_path: use pstrcpy in place of strncpy
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jim Meyering authored and Anthony Liguori committed Oct 5, 2012
1 parent 3178e27 commit d66f8e7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions block/vmdk.c
Expand Up @@ -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]) {
Expand Down

0 comments on commit d66f8e7

Please sign in to comment.