[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 01/10] locking: use virStrcpy instead of memcpy



---
 src/locking/lock_driver_sanlock.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
index 0b7c6d5..a054806 100644
--- a/src/locking/lock_driver_sanlock.c
+++ b/src/locking/lock_driver_sanlock.c
@@ -206,7 +206,14 @@ static int virLockManagerSanlockSetupLockspace(void)
         goto error;
     }
 
-    memcpy(ls.name, VIR_LOCK_MANAGER_SANLOCK_AUTO_DISK_LOCKSPACE, SANLK_NAME_LEN);
+    if (!virStrcpy(ls.name, VIR_LOCK_MANAGER_SANLOCK_AUTO_DISK_LOCKSPACE,
+                   SANLK_NAME_LEN)) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Lockspace path '%s' exceeded %d characters"),
+                       VIR_LOCK_MANAGER_SANLOCK_AUTO_DISK_LOCKSPACE,
+                       SANLK_PATH_LEN);
+        goto error;
+    }
     ls.host_id = 0; /* Doesn't matter for initialization */
     ls.flags = 0;
     if (!virStrcpy(ls.host_id_disk.path, path, SANLK_PATH_LEN)) {
-- 
1.7.11.7


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]