]> xenbits.xensource.com Git - libvirt.git/commitdiff
locking: use virStrcpyStatic instead of memcpy
authorJohn Ferlan <jferlan@redhat.com>
Fri, 18 Jan 2013 13:50:37 +0000 (08:50 -0500)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 24 Jan 2013 21:45:54 +0000 (22:45 +0100)
src/locking/lock_driver_sanlock.c

index 0b7c6d5edaa26f05b0ff0b4b4a88742bd3c0e5d2..95f7d61827efc0540c362f70472337de24031cd9 100644 (file)
@@ -206,7 +206,14 @@ static int virLockManagerSanlockSetupLockspace(void)
         goto error;
     }
 
-    memcpy(ls.name, VIR_LOCK_MANAGER_SANLOCK_AUTO_DISK_LOCKSPACE, SANLK_NAME_LEN);
+    if (!virStrcpyStatic(ls.name,
+                         VIR_LOCK_MANAGER_SANLOCK_AUTO_DISK_LOCKSPACE)) {
+        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)) {