mirror of https://gerrit.osmocom.org/libosmocore
get_value_string: Null terminate after the call to snprintf
It is impossible that the snprintf will fill the entire namebuf but just follow the idiom to make sure it is null terminated. Related: Coverity CID 1040676
This commit is contained in:
parent
047213b01e
commit
8d50600d7d
|
@ -31,6 +31,7 @@ const char *get_value_string(const struct value_string *vs, uint32_t val)
|
|||
}
|
||||
|
||||
snprintf(namebuf, sizeof(namebuf), "unknown 0x%x", val);
|
||||
namebuf[sizeof(namebuf) - 1] = '\0';
|
||||
return namebuf;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue