Skip to content

Fix CHECKED_RETURN defects in test_configuration.c#1110

Open
ejohnstown wants to merge 1 commit into
wolfSSL:masterfrom
ejohnstown:sf10
Open

Fix CHECKED_RETURN defects in test_configuration.c#1110
ejohnstown wants to merge 1 commit into
wolfSSL:masterfrom
ejohnstown:sf10

Conversation

@ejohnstown

Copy link
Copy Markdown
Contributor

Coverity flagged unchecked return values in the wolfsshd config tests:

  • Check the return code and the NULL check on the file handle returned by WFOPEN() in test_IncludeRecursionBound().
  • Cast the return on WREMOVE() to void in test_IncludeRecursionBound() and CleanupWildcardTest().

Issues: CID-646430, CID-646431

Coverity flagged unchecked return values in the wolfsshd config tests:

- Check the return code and the NULL check on the file handle returned
  by WFOPEN() in test_IncludeRecursionBound().
- Cast the return on WREMOVE() to void in test_IncludeRecursionBound()
  and CleanupWildcardTest().

Issues: CID-646430, CID-646431

@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 #1110

Scan targets checked: wolfssh-bugs, wolfssh-src

No new issues found in the changed files. ✅

Copilot AI left a comment

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.

Pull request overview

This PR addresses Coverity CHECKED_RETURN findings in the wolfsshd configuration unit tests by ensuring file-creation and cleanup calls are handled in a way that avoids “unchecked return” warnings and better reflects failure conditions.

Changes:

  • Updated wildcard test setup to check WFOPEN()’s return value before using the produced file handle.
  • Updated recursion-bound include test to treat WFOPEN() failures as fatal and silence WREMOVE() return values via (void) casts.
  • Added (void) casts to WREMOVE() in cleanup paths to explicitly ignore return values.

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


WFOPEN(NULL, &f, filepath, "w");
if (f) {
if (WFOPEN(NULL, &f, filepath, "w") == 0 && f != NULL) {

WFOPEN(NULL, &f, loopPath, "w");
if (f == NULL) {
if (WFOPEN(NULL, &f, loopPath, "w") != 0 || f == NULL) {
WFOPEN(NULL, &f, normalPath, "w");
if (f == NULL) {
WREMOVE(0, loopPath);
if (WFOPEN(NULL, &f, normalPath, "w") != 0 || f == NULL) {
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.

3 participants