From 7db850eea2d8d834f23adbb9b2c4a34ea8c48575 Mon Sep 17 00:00:00 2001 From: Nanook Claw Date: Fri, 15 May 2026 17:03:50 +0000 Subject: [PATCH] fix: check RAND_bytes during shred --- src/FileOperations.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/FileOperations.cpp b/src/FileOperations.cpp index ff144ef..800829d 100644 --- a/src/FileOperations.cpp +++ b/src/FileOperations.cpp @@ -922,7 +922,13 @@ bool FileOperations::shredFile(const std::string& path) } else { - RAND_bytes(buf.data(), static_cast(chunk)); + if (RAND_bytes(buf.data(), static_cast(chunk)) != 1) + { + std::cerr << "(shred) RAND_bytes failed pass " << (pass + 1) << ": " << path + << "\n"; + CloseHandle(hFile); + return false; + } } DWORD written = 0;