Skip to content

Fix wolfSSHD_ConfigCopy and wolfSSHD_ConfigFree#931

Merged
ejohnstown merged 1 commit intowolfSSL:masterfrom
yosuke-wolfssl:f_2074
Apr 17, 2026
Merged

Fix wolfSSHD_ConfigCopy and wolfSSHD_ConfigFree#931
ejohnstown merged 1 commit intowolfSSL:masterfrom
yosuke-wolfssl:f_2074

Conversation

@yosuke-wolfssl
Copy link
Copy Markdown
Contributor

@yosuke-wolfssl yosuke-wolfssl commented Apr 17, 2026

wolfSSHD_ConfigCopy() copies 8 string fields (banner, chrootDir, ciphers, hostKeyFile, hostKeyAlgos, kekAlgos, listenAddress, authKeysFile) but omits 4 others that exist on the WOLFSSHD_CONFIG struct: hostCertFile, pidFile, userCAKeysFile, and forceCmd. When a Match block triggers a config copy, these fields are silently lost, resulting in NULL pointers where valid strings are expected. Separately, wolfSSHD_ConfigFree() frees hostCertFile and pidFile but omits userCAKeysFile and forceCmd.

This PR fixes both of them and adds the regress tests.

@yosuke-wolfssl yosuke-wolfssl self-assigned this Apr 17, 2026
Copilot AI review requested due to automatic review settings April 17, 2026 08:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes wolfSSHD configuration lifetime bugs where Match-triggered config copies were dropping several string fields and config teardown was not freeing all owned strings, leading to NULL values and leaks in per-Match nodes.

Changes:

  • Copy additional config string fields in wolfSSHD_ConfigCopy() (hostCertFile, pidFile, userCAKeysFile, forceCmd).
  • Free additional config string fields in wolfSSHD_ConfigFree() (userCAKeysFile, forceCmd) alongside existing frees.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/wolfsshd/configuration.c
Comment thread apps/wolfsshd/configuration.c
Comment thread apps/wolfsshd/configuration.c Outdated
Comment thread apps/wolfsshd/configuration.c
@ejohnstown ejohnstown merged commit 0049c55 into wolfSSL:master Apr 17, 2026
131 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.

5 participants