fix klocwork issues:
Width is not specified for 's' conversion specifier.
This can result in an overflow of the buffer
provided in argument 3 of a call to 'sscanf'
Signed-off-by: songweibin <song.weibin@zte.com.cn>
(cherry picked from commit
5e8c412e63d6a86aa4846efe4cceff52ca8f16d5)
break;
char key[40];
long long value;
- int r = sscanf(line, "%s %lld", key, &value);
+ int r = sscanf(line, "%39s %lld", key, &value);
if (r == 2) {
if (strcmp(key, "MemTotal:") == 0)
(*m)["mem_total_kb"] = boost::lexical_cast<string>(value);
if (strstr(buf, "fsid")) {
uuid_d fsid;
char fsid_str[40];
- sscanf(strstr(buf, "fsid"), "fsid %s", fsid_str);
+ sscanf(strstr(buf, "fsid"), "fsid %39s", fsid_str);
r = fsid.parse(fsid_str);
if (!r) {
derr << "Invalid fsid" << dendl;