From c77dda6827f484358c8de92e491892f04b3a9779 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 23 Dec 2020 00:38:43 +0100 Subject: [PATCH] Kernel: Make KBuffer::try_create_with_bytes() actually copy the bytes KBuffers created with this API were actually just zero-filled instead of being populated with the provided bytes. Fixes #4493. --- Kernel/KBuffer.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Kernel/KBuffer.h b/Kernel/KBuffer.h index ade540b5fd..db73b4df39 100644 --- a/Kernel/KBuffer.h +++ b/Kernel/KBuffer.h @@ -63,6 +63,7 @@ public: return nullptr; if (!region->commit()) return nullptr; + memcpy(region->vaddr().as_ptr(), bytes.data(), bytes.size()); return adopt(*new KBufferImpl(region.release_nonnull(), bytes.size())); }