]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/os/filestore/BtrfsFileStoreBackend.cc
import 15.2.0 Octopus source
[ceph.git] / ceph / src / os / filestore / BtrfsFileStoreBackend.cc
index 2ff2000d709166cb7f91fca2374741d92c11773f..d2d016e790fe471e466348ea41c3333050f12f01 100644 (file)
@@ -466,7 +466,8 @@ int BtrfsFileStoreBackend::destroy_checkpoint(const string& name)
   btrfs_ioctl_vol_args vol_args;
   memset(&vol_args, 0, sizeof(vol_args));
   vol_args.fd = 0;
-  strncpy(vol_args.name, name.c_str(), sizeof(vol_args.name));
+  strncpy(vol_args.name, name.c_str(), sizeof(vol_args.name) - 1);
+  vol_args.name[sizeof(vol_args.name) - 1] = '\0';
 
   int ret = ::ioctl(get_basedir_fd(), BTRFS_IOC_SNAP_DESTROY, &vol_args);
   if (ret) {