Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 32852a81 authored by Xi Wang's avatar Xi Wang Committed by Sage Weil
Browse files

ceph: fix length validation in parse_reply_info()



"len" is read from network and thus needs validation.  Otherwise, given
a bogus "len" value, p+len could be an out-of-bounds pointer, which is
used in further parsing.

Signed-off-by: default avatarXi Wang <xi.wang@gmail.com>
Signed-off-by: default avatarSage Weil <sage@newdream.net>
parent ab434b60
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -262,6 +262,7 @@ static int parse_reply_info(struct ceph_msg *msg,
	/* trace */
	ceph_decode_32_safe(&p, end, len, bad);
	if (len > 0) {
		ceph_decode_need(&p, end, len, bad);
		err = parse_reply_info_trace(&p, p+len, info, features);
		if (err < 0)
			goto out_bad;
@@ -270,6 +271,7 @@ static int parse_reply_info(struct ceph_msg *msg,
	/* extra */
	ceph_decode_32_safe(&p, end, len, bad);
	if (len > 0) {
		ceph_decode_need(&p, end, len, bad);
		err = parse_reply_info_extra(&p, p+len, info, features);
		if (err < 0)
			goto out_bad;