mirror of
https://github.com/ceph/ceph
synced 2025-01-20 10:01:45 +00:00
osd: update sprintf() to snprintf()
Which is safer. Also enlarge length of name to 32, which shall be big enough to hold a int64_t value. Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
This commit is contained in:
parent
8101df0024
commit
083a0064a3
@ -2771,8 +2771,8 @@ int OSDMap::build_simple_crush_map(CephContext *cct, CrushWrapper& crush,
|
||||
loc["rack"] = "localrack";
|
||||
loc["root"] = "default";
|
||||
ldout(cct, 10) << " adding osd." << o << " at " << loc << dendl;
|
||||
char name[8];
|
||||
sprintf(name, "osd.%d", o);
|
||||
char name[32];
|
||||
snprintf(name, sizeof(name), "osd.%d", o);
|
||||
crush.insert_item(cct, o, 1.0, name, loc);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user