forked from OSchip/llvm-project
[UB] Fix another place where we would pass a null pointer to memcpy.
This too was found by UBSan. Down to 35 failures for me. llvm-svn: 243932
This commit is contained in:
parent
0cbe2efcd6
commit
13c247b455
|
@ -158,7 +158,8 @@ public:
|
|||
|
||||
// Copy the string information.
|
||||
char *StrBuffer = const_cast<char*>(NewItem->getKeyData());
|
||||
memcpy(StrBuffer, Key.data(), KeyLength);
|
||||
if (KeyLength > 0)
|
||||
memcpy(StrBuffer, Key.data(), KeyLength);
|
||||
StrBuffer[KeyLength] = 0; // Null terminate for convenience of clients.
|
||||
return NewItem;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue