libceph: weaken sizeof check in ceph_x_verify_authorizer_reply()

Allow for extending ceph_x_authorize_reply in the future.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Ilya Dryomov 2018-07-27 19:45:36 +02:00
parent 130f52f2b2
commit f1d10e0463
1 changed files with 4 additions and 2 deletions

View File

@ -737,8 +737,10 @@ static int ceph_x_verify_authorizer_reply(struct ceph_auth_client *ac,
ret = ceph_x_decrypt(&au->session_key, &p, p + CEPHX_AU_ENC_BUF_LEN); ret = ceph_x_decrypt(&au->session_key, &p, p + CEPHX_AU_ENC_BUF_LEN);
if (ret < 0) if (ret < 0)
return ret; return ret;
if (ret != sizeof(*reply)) if (ret < sizeof(*reply)) {
return -EPERM; pr_err("bad size %d for ceph_x_authorize_reply\n", ret);
return -EINVAL;
}
if (au->nonce + 1 != le64_to_cpu(reply->nonce_plus_one)) if (au->nonce + 1 != le64_to_cpu(reply->nonce_plus_one))
ret = -EPERM; ret = -EPERM;