Use snprintf
instead of sprintf
(ref #4361)
This commit is contained in:
parent
5522cdd201
commit
7e5655eef4
1 changed files with 1 additions and 1 deletions
|
@ -51,7 +51,7 @@ std::string to_hex(const char* blob, std::size_t size)
|
||||||
std::memset(hex, 0, 3);
|
std::memset(hex, 0, 3);
|
||||||
for (std::size_t pos = 0; pos < size; ++pos)
|
for (std::size_t pos = 0; pos < size; ++pos)
|
||||||
{
|
{
|
||||||
std::sprintf(hex, "%02x", int(blob[pos]) & 0xff);
|
std::snprintf(hex, 3, "%02x", int(blob[pos]) & 0xff);
|
||||||
s << hex;
|
s << hex;
|
||||||
}
|
}
|
||||||
return s.str();
|
return s.str();
|
||||||
|
|
Loading…
Reference in a new issue