AK: Don't call memcpy with null argument in ByteBuffer::copy()

This was happening in TestBase64.test_decode, while copying an empty
string.
This commit is contained in:
Andrew Kaster 2021-05-16 13:46:33 -06:00 committed by Linus Groh
commit 11214bc94d
Notes: sideshowbarker 2024-07-18 17:59:56 +09:00

View file

@ -74,6 +74,7 @@ public:
[[nodiscard]] static ByteBuffer copy(void const* data, size_t size)
{
auto buffer = create_uninitialized(size);
if (size != 0)
__builtin_memcpy(buffer.data(), data, size);
return buffer;
}