Browse Source

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.
Andreas Kling 4 years ago
parent
commit
c77dda6827
1 changed files with 1 additions and 0 deletions
  1. 1 0
      Kernel/KBuffer.h

+ 1 - 0
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()));
     }