mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-23 18:15:35 +00:00
Merge pull request #3799 from d3zd3z/fixchar
Fix ssl_context_info handling of EOF (build failure if char is unsigned)
This commit is contained in:
commit
ec32a74024
4
ChangeLog.d/bugfix_3794.txt
Normal file
4
ChangeLog.d/bugfix_3794.txt
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
Bugfix
|
||||||
|
* Fix handling of EOF against 0xff bytes and on platforms with
|
||||||
|
unsigned chars. Fixes a build failure on platforms where char is
|
||||||
|
unsigned. Fixes #3794.
|
|
@ -377,13 +377,13 @@ size_t read_next_b64_code( uint8_t **b64, size_t *max_len )
|
||||||
int valid_balance = 0; /* balance between valid and invalid characters */
|
int valid_balance = 0; /* balance between valid and invalid characters */
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
char pad = 0;
|
char pad = 0;
|
||||||
char c = 0;
|
int c = 0;
|
||||||
|
|
||||||
while( EOF != c )
|
while( EOF != c )
|
||||||
{
|
{
|
||||||
char c_valid = 0;
|
char c_valid = 0;
|
||||||
|
|
||||||
c = (char) fgetc( b64_file );
|
c = fgetc( b64_file );
|
||||||
|
|
||||||
if( pad > 0 )
|
if( pad > 0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -166,6 +166,7 @@ if (NOT ${CMAKE_CURRENT_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
link_to_source(seedfile)
|
link_to_source(seedfile)
|
||||||
endif()
|
endif()
|
||||||
link_to_source(compat.sh)
|
link_to_source(compat.sh)
|
||||||
|
link_to_source(context-info.sh)
|
||||||
link_to_source(data_files)
|
link_to_source(data_files)
|
||||||
link_to_source(scripts)
|
link_to_source(scripts)
|
||||||
link_to_source(ssl-opt.sh)
|
link_to_source(ssl-opt.sh)
|
||||||
|
|
|
@ -430,6 +430,11 @@ run_test "Binary file instead of text file" \
|
||||||
-u "Too many bad symbols detected. File check aborted" \
|
-u "Too many bad symbols detected. File check aborted" \
|
||||||
-n "Deserializing"
|
-n "Deserializing"
|
||||||
|
|
||||||
|
run_test "Decoder continues past 0xff character" \
|
||||||
|
"def_b64_ff.bin" \
|
||||||
|
-n "No valid base64" \
|
||||||
|
-u "ciphersuite.* TLS-"
|
||||||
|
|
||||||
|
|
||||||
# End of tests
|
# End of tests
|
||||||
|
|
||||||
|
|
5
tests/data_files/base64/def_b64_ff.bin
Normal file
5
tests/data_files/base64/def_b64_ff.bin
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
// Ensure that the b64 parser continues after encountering a 0xFF
|
||||||
|
// character. Note that this byte is invalid UTF-8, making this
|
||||||
|
// entire file invalid UTF-8. Use care when editing.
|
||||||
|
// -> ÿ <-
|
||||||
|
AhUAAH8AAA4AAABtAAAAAF6HQx3MqAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACG2QbHbUj8eGpdx5KVIebiwk0jvRj9/3m6BOSzpA7qBXeEunhqr3D11NE7ciGjeHMAAACAAAAAAAAAAAAAAAAAAV6HQx248L77RH0Z973tSYNQ8zBsz861CZG5/T09TJz3XodDHe/iJ+cgXb5An3zTdnTBtw3EWAb68T+gCE33GN8AAAAAAAAAAAAAAAEAAAAAAAAAAwAAAQAAAAAAAgAAAA==
|
Loading…
Reference in a new issue