-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lws_b64_decode_stateful truncates response #2855
Comments
darhaywa
added a commit
to darhaywa/libwebsockets
that referenced
this issue
Mar 23, 2023
Addresses issue warmcat#2855 by allowing the parsing of the final byte when there are at least 3 bytes remaining in the buffer. For every 4 bytes of input, a maximum of 3 bytes of output are generated when decoding the base64 string. The buffer space, therefore, only requires an additional 3 bytes of space. The code checks for space in the buffer before adding null termination.
lws-team
pushed a commit
that referenced
this issue
Nov 13, 2023
Addresses issue #2855 by allowing the parsing of the final byte when there are at least 3 bytes remaining in the buffer. For every 4 bytes of input, a maximum of 3 bytes of output are generated when decoding the base64 string. The buffer space, therefore, only requires an additional 3 bytes of space. The code checks for space in the buffer before adding null termination.
lws-team
pushed a commit
that referenced
this issue
Nov 13, 2023
Addresses issue #2855 by allowing the parsing of the final byte when there are at least 3 bytes remaining in the buffer. For every 4 bytes of input, a maximum of 3 bytes of output are generated when decoding the base64 string. The buffer space, therefore, only requires an additional 3 bytes of space. The code checks for space in the buffer before adding null termination.
lws-team
pushed a commit
that referenced
this issue
Nov 24, 2023
Addresses issue #2855 by allowing the parsing of the final byte when there are at least 3 bytes remaining in the buffer. For every 4 bytes of input, a maximum of 3 bytes of output are generated when decoding the base64 string. The buffer space, therefore, only requires an additional 3 bytes of space. The code checks for space in the buffer before adding null termination.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Accurately sized output buffers have truncated decodes.
Given the following base64 encoded string of 1708 characters, which decodes to 1279 bytes on https://cryptii.com/pipes/base64-to-binary, when passed through lws_b64_decode_string_len(inputString, 1708, outputBuffer, 1281) only 1278 bytes are returned. This continues until the output buffer size of 1283 is provided.
The text was updated successfully, but these errors were encountered: