From b5af1bf3acac1383ab23efec05c847851fcce130 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 9 Mar 2026 21:08:36 +0000 Subject: util/nvmutil: add guard in rhex() i removed this before, but it's good to put it here defensively, in case i ever mess up the urandom read function again. Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'util/nvmutil/nvmutil.c') diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 8a2d6ef0..314d4755 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -973,6 +973,9 @@ rhex(void) #else n = (size_t)read_dev_urandom( urandom_fd, rnum, sizeof(rnum)); + + if (!n || n > sizeof(rnum)) + err(ECANCELED, "Randomisation failure"); #endif } -- cgit v1.2.1