Commit 3977058c authored by Ilya Dryomov's avatar Ilya Dryomov Committed by Sage Weil

libceph: safely decode max_osd value in osdmap_decode()

max_osd value is not covered by any ceph_decode_need().  Use a safe
version of ceph_decode_* macro to decode it.
Signed-off-by: default avatarIlya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: default avatarAlex Elder <elder@linaro.org>
parent 597b52f6
...@@ -687,9 +687,10 @@ static int osdmap_set_max_osd(struct ceph_osdmap *map, int max) ...@@ -687,9 +687,10 @@ static int osdmap_set_max_osd(struct ceph_osdmap *map, int max)
static int osdmap_decode(void **p, void *end, struct ceph_osdmap *map) static int osdmap_decode(void **p, void *end, struct ceph_osdmap *map)
{ {
u16 version; u16 version;
u32 len, max, i;
u32 epoch = 0; u32 epoch = 0;
void *start = *p; void *start = *p;
u32 max;
u32 len, i;
int err; int err;
struct ceph_pg_pool_info *pi; struct ceph_pg_pool_info *pi;
...@@ -736,7 +737,8 @@ static int osdmap_decode(void **p, void *end, struct ceph_osdmap *map) ...@@ -736,7 +737,8 @@ static int osdmap_decode(void **p, void *end, struct ceph_osdmap *map)
ceph_decode_32_safe(p, end, map->flags, e_inval); ceph_decode_32_safe(p, end, map->flags, e_inval);
max = ceph_decode_32(p); /* max_osd */
ceph_decode_32_safe(p, end, max, e_inval);
/* (re)alloc osd arrays */ /* (re)alloc osd arrays */
err = osdmap_set_max_osd(map, max); err = osdmap_set_max_osd(map, max);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment