Removed double free - #281
Conversation
773bfc7 to
283bac9
Compare
283bac9 to
884ee51
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #281
Scan targets checked: wolfclu-bugs, wolfclu-src
Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Findings are non-blocking.
| opterr = 0; /* do not display unrecognized options */ | ||
| optind = 0; /* start at indent 0 */ | ||
| while ((option = wolfCLU_GetOpt(argc, argv, "", | ||
| while (ret == WOLFCLU_SUCCESS && (option = wolfCLU_GetOpt(argc, argv, "", |
There was a problem hiding this comment.
⚪ [Info] New loop guard suppresses -help output when an earlier option handler fails · Logic errors
wolfCLU_GetOpt scans base64_options[] in table order, so -in/-out are always handled before WOLFCLU_HELP regardless of argv position. With the added ret == WOLFCLU_SUCCESS guard, wolfssl base64 -help -in /nonexistent now returns -1 without printing help; previously help was printed.
Related known finding #8060 (similar but distinct): Both affect wolfCLU_Base64Setup and table-ordered option processing, but this concerns the new ret loop guard preventing help output after an earlier failure; #8060 frees bioIn twice after an output-file-open failure. Their faulting operations, root causes, and required patches differ.
Fix: If -help should take precedence, check for the help flag before the option loop rather than relying on table-order parsing.
https://fenrir.wolfssl.com/finding/8060
Removed needless free and now all logic will all fall to common clean up at end of setup function.