mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-22 10:30:05 +00:00
fix UB in fuzzer common (memcpy on nullptr)
This commit is contained in:
parent
e77686f7a8
commit
7af1dc1d27
@ -56,7 +56,9 @@ struct data_to_string {
|
||||
|
||||
data_to_string(const uint8_t* data, size_t size, bool add_terminator = false)
|
||||
: buffer(size + (add_terminator ? 1 : 0)) {
|
||||
std::memcpy(buffer.data(), data, size);
|
||||
if (size) {
|
||||
std::memcpy(buffer.data(), data, size);
|
||||
}
|
||||
}
|
||||
|
||||
fmt::string_view get() const { return {buffer.data(), buffer.size()}; }
|
||||
|
Loading…
Reference in New Issue
Block a user