mirror of
https://github.com/ceph/ceph
synced 2025-02-23 11:07:35 +00:00
Merge pull request #11148 from dillaman/wip-17310
librbd: block name prefix might overflow fixed size C-string Reviewed-by: Mykola Golub <mgolub@mirantis.com>
This commit is contained in:
commit
83697fd5aa
@ -475,9 +475,10 @@ int mirror_image_disable_internal(ImageCtx *ictx, bool force,
|
||||
info.obj_size = 1ULL << obj_order;
|
||||
info.num_objs = Striper::get_num_objects(ictx->layout, info.size);
|
||||
info.order = obj_order;
|
||||
memcpy(&info.block_name_prefix, ictx->object_prefix.c_str(),
|
||||
min((size_t)RBD_MAX_BLOCK_NAME_SIZE,
|
||||
ictx->object_prefix.length() + 1));
|
||||
strncpy(info.block_name_prefix, ictx->object_prefix.c_str(),
|
||||
RBD_MAX_BLOCK_NAME_SIZE);
|
||||
info.block_name_prefix[RBD_MAX_BLOCK_NAME_SIZE - 1] = '\0';
|
||||
|
||||
// clear deprecated fields
|
||||
info.parent_pool = -1L;
|
||||
info.parent_name[0] = '\0';
|
||||
|
Loading…
Reference in New Issue
Block a user