virFileLoopDeviceAssociate: Use virStrcpy instead of virStrncpy

Passing 'strlen(src)' for length makes it equivalent to virStrcpy.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2021-03-02 12:50:36 +01:00
parent e8f5711274
commit 9595c61625

View File

@ -810,8 +810,7 @@ int virFileLoopDeviceAssociate(const char *file,
lo.lo_flags = LO_FLAGS_AUTOCLEAR;
/* Set backing file name for LOOP_GET_STATUS64 queries */
if (virStrncpy((char *) lo.lo_file_name, file,
strlen(file), LO_NAME_SIZE) < 0) {
if (virStrcpy((char *) lo.lo_file_name, file, LO_NAME_SIZE) < 0) {
virReportSystemError(errno,
_("Unable to set backing file %s"), file);
goto cleanup;