From e45337e52bdcd902980294ed0b7d8aa6953b523d Mon Sep 17 00:00:00 2001 From: Mike Date: Wed, 25 Mar 2026 14:01:15 +0200 Subject: [PATCH] crypto.rand: do not go beyond the buffer boundaries (#26764) --- vlib/crypto/rand/rand_linux.c.v | 1 + vlib/crypto/rand/rand_solaris.c.v | 1 + 2 files changed, 2 insertions(+) diff --git a/vlib/crypto/rand/rand_linux.c.v b/vlib/crypto/rand/rand_linux.c.v index 2b2f053c5..2cf355d8d 100644 --- a/vlib/crypto/rand/rand_linux.c.v +++ b/vlib/crypto/rand/rand_linux.c.v @@ -25,6 +25,7 @@ pub fn read(bytes_needed int) ![]u8 { return &ReadError{} } bytes_read += rbytes + remaining_bytes -= rbytes } return unsafe { buffer.vbytes(bytes_needed) } } diff --git a/vlib/crypto/rand/rand_solaris.c.v b/vlib/crypto/rand/rand_solaris.c.v index 9552fce91..241a09559 100644 --- a/vlib/crypto/rand/rand_solaris.c.v +++ b/vlib/crypto/rand/rand_solaris.c.v @@ -28,6 +28,7 @@ pub fn read(bytes_needed int) ![]u8 { return &ReadError{} } bytes_read += rbytes + remaining_bytes -= rbytes } return unsafe { buffer.vbytes(bytes_needed) } } -- 2.39.5