Skip to content

fix: check RAND_bytes during shred#9

Merged
lextpf merged 1 commit into
lextpf:mainfrom
nanookclaw:fix/check-rand-bytes-shred
May 16, 2026
Merged

fix: check RAND_bytes during shred#9
lextpf merged 1 commit into
lextpf:mainfrom
nanookclaw:fix/check-rand-bytes-shred

Conversation

@nanookclaw
Copy link
Copy Markdown
Contributor

@nanookclaw nanookclaw commented May 15, 2026

What changed

shredFile now checks the return value from RAND_bytes before writing each random overwrite chunk. If OpenSSL reports a failure, the function logs the failed pass, closes the file handle, and returns false instead of continuing with stale buffer contents and later deleting the file.

This mirrors the existing failure handling around seek/write operations in the same loop and leaves the zero-fill pass unchanged.

Closes #7.

Verification

  • git diff --check

I could not run the full Windows/MSVC/vcpkg test workflow from this Linux environment, and clang-format is not installed here.

@lextpf
Copy link
Copy Markdown
Owner

lextpf commented May 15, 2026

Hi @nanookclaw,

Thanks for jumping in so quickly, having another pair of eyes on this is always appreciated! 😊
Your changes look good and you have my approval! I'll merge this back ASAP

If you'd like to dive in deeper as a contributer:

The project is a bit opaque about where assets live and it's a bit tricky to set up your own assets which means runtime testing can be quite cumbersome, if you'd like to test locally yourself here are two easy ways to get you up and running in case you want to be more hands-on for future issues:

What you might need How to get it Notes
Full pre-built project from your branch ➜ Add me on Discord (@lextpf). Unzip anywhere and run the executable.
Only the assets (if you want to build yourself) ➜ Add me on Discord (@lextpf). After cloning the repo, drop the assets/ folder from this ZIP into the repo root, then build.

Let me know if you need support and we can arrange something, and thanks again for volunteering and helping improve Seal, you're always welcome to work on future issues! 🦭

Alex

@nanookclaw
Copy link
Copy Markdown
Contributor Author

Appreciate the review and the setup notes. I’ll wait for the current CI run to settle; if anything fails, I’ll follow up on this branch.

I’ll skip Discord for now so the contribution trail stays on GitHub, but the asset-layout context is useful for future Seal issues.

@lextpf lextpf self-assigned this May 15, 2026
@lextpf lextpf merged commit 203d1e8 into lextpf:main May 16, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Seal shred silently ignores RAND_bytes failures during overwrite passes

2 participants