go-mail icon indicating copy to clipboard operation
go-mail copied to clipboard

Fix "short writes" in Base64LineBreaker.Write

Open dolmen opened this issue 8 months ago • 1 comments

The count of bytes written is incorrectly reported by Base64LineBreaker.Write. This issue is not visible externally as Base64LineBreaker.Write is only called via encoding/base64.Encoder.Write (like in the original implementation in stdlib encoding/pem.lineBreaker) which ignores the returned bytes count.

The issue is not visible either with the test suite (not even via the current fuzzing tests) because the tests also use Base64LineBreaker through the encoding/base64.Encoder.

So we could just keep the existing code. The only risk is if encoding/base64 behavior changes in the future.

See also CL 653675 which aims to fix the same issue in encoding/pem.

dolmen avatar Feb 28 '25 20:02 dolmen