Skip to content

Clear secret buffers with a wipe the compiler keeps - #114

Merged
Neo-Desktop merged 1 commit into
mainfrom
claude/project-thread-6jr0mj
Dec 1, 2026
Merged

Neo-Desktop merged 1 commit into
mainfrom
claude/project-thread-6jr0mj

Conversation

@Neo-Desktop

Copy link
Copy Markdown
Contributor

Requested by Sydney · project thread

Summary

This PR corrects 1 code scanning finding of the rule Call to memset may be deleted (ssh/src/ppk.c).

  • A compiler can remove a memset on a buffer that is not used again. A new function, wipe(), writes the zeros through a volatile pointer, thus the compiler keeps them.
  • All 25 memset(…, 0, …) calls in ppk.c now use wipe(). The result of each call does not change.
  • This is the same change as in D-Modem/app, which has the same ppk.c.

Test

  • The same ppk.c change in D-Modem/app builds with -Wall -Wextra -Werror and its dmodemssh_test passes.
  • CI on this PR runs the SSH tests and the sanitizers.

Generated by Claude Code

ppk.c cleared keys and other secret data with memset. A compiler can
remove a memset on a buffer that is not used again. A new function,
wipe(), writes the zeros through a volatile pointer, thus the compiler
keeps the writes. All the memset calls in ppk.c now use wipe(). The
result of each call does not change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRUrfg8fQaXPrMeiQ9h
Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
@Neo-Desktop Neo-Desktop self-assigned this Dec 1, 2026
@Neo-Desktop
Neo-Desktop merged commit 78931de into main Dec 1, 2026
20 checks passed
@Neo-Desktop
Neo-Desktop deleted the claude/project-thread-6jr0mj branch December 1, 2026 07:25
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.

1 participant