From: Peter Krempa Date: Tue, 2 Mar 2021 11:12:11 +0000 (+0100) Subject: sanlock: Use virStrcpy instead of virStrncpy X-Git-Tag: v7.2.0-rc1~233 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33122ed16fd6f7191df9d5f8f5698eb0f6297530;p=thirdparty%2Flibvirt.git sanlock: Use virStrcpy instead of virStrncpy We want a (possibly truncated) copy of the full source string so virStrcpy is a better fit. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c index aaffe30e6f..1d8f109375 100644 --- a/src/locking/lock_driver_sanlock.c +++ b/src/locking/lock_driver_sanlock.c @@ -924,9 +924,7 @@ static int virLockManagerSanlockAcquire(virLockManagerPtr lock, /* sanlock doesn't use owner_name for anything, so it's safe to take just * the first SANLK_NAME_LEN - 1 characters from vm_name */ - ignore_value(virStrncpy(opt->owner_name, priv->vm_name, - MIN(strlen(priv->vm_name), SANLK_NAME_LEN - 1), - SANLK_NAME_LEN)); + virStrcpy(opt->owner_name, priv->vm_name, SANLK_NAME_LEN); if (state && STRNEQ(state, "")) { if ((rv = sanlock_state_to_args((char *)state,