Fenrir Fix: Base64 stdin input is silently truncated at 8000 bytes - #286
Fenrir Fix: Base64 stdin input is silently truncated at 8000 bytes#286aidankeefe2022 wants to merge 3 commits into
Conversation
1b35e33 to
556dc5a
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #286
Scan targets checked: wolfclu-bugs, wolfclu-src
Findings: 4
4 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Reported findings require changes before merge.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #286
Scan targets checked: wolfclu-bugs, wolfclu-src
Findings: 2
2 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Reported findings require changes before merge.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #286
Scan targets checked: wolfclu-bugs, wolfclu-src
Findings: 2
2 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Reported findings require changes before merge.
df9086c to
a022b83
Compare
a022b83 to
dc4ea63
Compare
fixed + hallucinations
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #286
Scan targets checked: wolfclu-src, wolfclu-bugs
Findings: 2
2 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Reported findings require changes before merge.
| break; | ||
| } | ||
|
|
||
| if (read == 0) { |
There was a problem hiding this comment.
Zero-byte stdin read hides I/O errors as EOF · Incorrect error handling
StreamRead treats a zero BIO read as EOF, but wolfSSL's file BIO forwards fread, which also returns zero on input errors. The command reports success with a truncated Base64 prefix; unlike known #11088, this lacks EOF/error discrimination.
Related known finding #12926 (similar but distinct): Both mishandle BIO input-read failure conditions, but this is StreamRead treating a zero return as EOF without error discrimination; #12926 is wolfCLU_CRLVerify discarding the read result and using a seek-derived length. They have different functions, faulting operations, root causes, and required patches.
Suggested fix: Distinguish EOF from stream failure after a zero read and return WOLFCLU_FATAL_ERROR for failure.
Basis: ISO/IEC 9899:2018 §§7.21.8.1 and 7.21.10.3 require the stream indicators to distinguish fread end-of-file from error.
| wolfCLU_LogError("Could not get file pointer from BIO"); | ||
| return WOLFCLU_FATAL_ERROR; | ||
| } | ||
| if (XFSEEK(innerFp, 0, SEEK_END) != 0) { |
There was a problem hiding this comment.
FileRead bypasses the XFILE seek-origin abstraction · API contract violations
FileRead passes stdio SEEK_END to the selected XFSEEK backend instead of its paired XSEEK_END. Non-stdio backends use the wrong origin and fail or mis-size input; unlike known #6884, this is an abstraction mismatch, not integer truncation.
Suggested fix: Pass XSEEK_END to XFSEEK so the origin matches the selected XFILE backend.
Basis: wolfSSL wc_port.h defines XSEEK_END as the backend-specific seek-origin constant paired with XFSEEK.
Added read/write io functions that can be used to interact with any file pointer
Fix for Fenrir finding : https://fenrir.wolfssl.com/finding/11088