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; } }