mirror of
https://github.com/ceph/ceph
synced 2025-01-03 01:22:53 +00:00
rbd: Prevent Seg fault by checking read result in snap_read_header()
Signed-off-by: David Zafman <david.zafman@inktank.com>
This commit is contained in:
parent
9c6733e662
commit
409999c3b2
@ -115,7 +115,11 @@ static int snap_read_header(cls_method_context_t hctx, bufferlist& bl)
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
if (bl.length() < sizeof(*header))
|
||||
return -EINVAL;
|
||||
|
||||
header = (struct rbd_obj_header_ondisk *)bl.c_str();
|
||||
assert(header);
|
||||
|
||||
if ((snap_count != header->snap_count) ||
|
||||
(snap_names_len != header->snap_names_len)) {
|
||||
|
Loading…
Reference in New Issue
Block a user