mirror of
https://github.com/gperftools/gperftools
synced 2024-12-23 15:52:10 +00:00
avoid undefined behavior when parsing proc maps
Clang's undefined behavior sanitized correctly pointed out that memmove requires non-nil args, so lets initialize sbuf to something.
This commit is contained in:
parent
9b5838f084
commit
dec85dcc03
@ -258,8 +258,10 @@ bool ForEachLine(const char* path, const Body& body) {
|
||||
return false;
|
||||
}
|
||||
|
||||
char* sbuf = nullptr;
|
||||
char* ebuf = nullptr;
|
||||
char* sbuf = buf; // note, initial value could be nullptr, but
|
||||
// memmove actually insists to get non-null
|
||||
// arguments (even when count is 0)
|
||||
char* ebuf = sbuf;
|
||||
|
||||
bool eof = false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user