Skip to content

Minor internal and wolfsshd fixes - #1258

Open
stenslae wants to merge 1 commit into
wolfSSL:masterfrom
stenslae:fix-nits
Open

stenslae wants to merge 1 commit into
wolfSSL:masterfrom
stenslae:fix-nits

Conversation

@stenslae

Copy link
Copy Markdown
Member

Reworked the wide-char to multibyte conversion so the exact buffer size needed is used. Removed dead ECC agent code, as only RSA supports agent signing. Added an intialized to 0 to avoid use-of-unitialized value warnings.

@stenslae stenslae self-assigned this Sep 16, 2026

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #1258

⚠️ An internal error occurred during the automated review. This error has been logged. Please contact the Fenrir team if you need assistance.

Error: RuntimeError

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #1258

⚠️ An internal error occurred during the automated review. This error has been logged. Please contact the Fenrir team if you need assistance.

Error: RuntimeError

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #1258

⚠️ An internal error occurred during the automated review. This error has been logged. Please contact the Fenrir team if you need assistance.

Error: RuntimeError

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #1258

⚠️ An internal error occurred during the automated review. This error has been logged. Please contact the Fenrir team if you need assistance.

Error: RuntimeError

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #1258

Scan targets checked: wolfssh-src, wolfssh-bugs

Fenrir result: Approved ✅

No new issues found in the changed files.

Advisory only — this automated result does not count as a GitHub approval.

@stenslae stenslae assigned wolfSSL-Bot and unassigned stenslae Sep 16, 2026
@ejohnstown
ejohnstown self-requested a review September 17, 2026 19:52
Comment thread apps/wolfsshd/wolfsshd.c
WFREE(ret, heap, DYNTYPE_SSHD);
ret = NULL;
/* Set *err to WS_MEMORY_E on alloc failure, or WS_FATAL_ERROR on conversion failure. */
static char* _convertHelper(WCHAR* in, void* heap, int* err) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Convention: The opening brace for a function should be on its own line.

Comment thread apps/wolfsshd/wolfsshd.c
char* ret = NULL;
size_t needed = 0;

/* Query exact size needed for multi-byte ACPs. Avoids zero-size for empty args. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Convention: Lines are supposed to wrap before column 80. Just kick the second sentence to the next line.

Comment thread src/internal.c
/* No WOLFSSH_AGENT branch: only RSA certs support agent signing. */
if (authData->sf.publicKey.privateKey == NULL ||
authData->sf.publicKey.privateKeySz == 0) {
/* Avoid misleading ASN error for cert-store-only clients without in-memory key. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Convention: Lines are supposed to wrap before column 80. Just split it somewhere.

Comment thread src/internal.c
&idx, &keySig->ks.ecc.key,
authData->sf.publicKey.privateKeySz);
}
/* No WOLFSSH_AGENT branch: only RSA certs support agent signing. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reword. Among the certificate key types, only RSA implements agent signing. Plain ECDSA keys do use the agent, in the non-certificate ECC path.

Comment thread src/internal.c
}
else
#endif /* WOLFSSH_WINDOWS_CERT_STORE */
/* No WOLFSSH_AGENT branch: only RSA certs support agent signing. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reword. Among the certificate key types, only RSA implements agent signing. Plain ECDSA keys do use the agent, in the non-certificate ECC path.

Comment thread apps/wolfsshd/wolfsshd.c
}
else {
size_t numConv = 0;
if (wcstombs_s(&numConv, ret, needed, in, needed - 1) != 0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

needed is already big enough. You don't need to subtract 1 here. The sizing query returns the size including the terminating null and that's what you allocate, so pass needed for the count too.

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.

4 participants