By definition, epoch_t is of type __u32 and shall allow
13 epochs/second for 10 years. The biggest epoch we can
ever see is
4294967296, which is 10 chars long.
However, by declaring "char foo[20];" here, we leave
8 chars (20 - 11("inc_osdmap.") - 1('\0') = 8) for the
epoch field only, so the epoch will get truncated when
it becomes big enough, which is unsafe.
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
return ghobject_t(hobject_t(sobject_t(object_t(foo), 0)));
}
static ghobject_t get_inc_osdmap_pobject_name(epoch_t epoch) {
- char foo[20];
+ char foo[22];
snprintf(foo, sizeof(foo), "inc_osdmap.%d", epoch);
return ghobject_t(hobject_t(sobject_t(object_t(foo), 0)));
}