Skip to content

Add the cleanup path and validations of XFSEEK and XFTELL#217

Closed
yosuke-wolfssl wants to merge 1 commit intowolfSSL:mainfrom
yosuke-wolfssl:fix_1484
Closed

Add the cleanup path and validations of XFSEEK and XFTELL#217
yosuke-wolfssl wants to merge 1 commit intowolfSSL:mainfrom
yosuke-wolfssl:fix_1484

Conversation

@yosuke-wolfssl
Copy link
Copy Markdown
Contributor

This PR adds the cleanup path of file descriptor 'f' and the allocated memory 'data' explicitly. (f1484)
Also, this evaluates the return value of XFSEEK and XFTELL before using it.

@yosuke-wolfssl yosuke-wolfssl self-assigned this Apr 2, 2026
Copilot AI review requested due to automatic review settings April 2, 2026 06:35
Copy link
Copy Markdown

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

This PR improves robustness of the signing input-file read path by adding explicit cleanup for the input file handle and buffer, and by validating XFSEEK/XFTELL results before proceeding.

Changes:

  • Initialize locals and add a unified cleanup: path to ensure XFCLOSE/XFREE are always executed on error.
  • Check XFSEEK return value when seeking to end-of-file and back to start.
  • Validate the XFTELL-derived file size before allocating and reading.

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

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.

2 participants