From a8ca3de522002a5e8da81bd2aa6de35a52a96219 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 27 Apr 2017 23:06:45 -0400 Subject: [PATCH] libcephfs: handle path==null to ceph_get_osd_crush_location Signed-off-by: Sage Weil --- src/libcephfs.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libcephfs.cc b/src/libcephfs.cc index 0446edb99f1..a196dc669d9 100644 --- a/src/libcephfs.cc +++ b/src/libcephfs.cc @@ -1224,9 +1224,11 @@ extern "C" int ceph_get_osd_crush_location(struct ceph_mount_info *cmount, string& name = it->second; needed += type.size() + name.size() + 2; if (needed <= len) { - strcpy(path + cur, type.c_str()); + if (path) + strcpy(path + cur, type.c_str()); cur += type.size() + 1; - strcpy(path + cur, name.c_str()); + if (path) + strcpy(path + cur, name.c_str()); cur += name.size() + 1; } }