Fix client simulation

In `create_client_simulation_tls_clienthello()` the variable `sni_extension_found` should be set if the ClientHello includes an SNI extension. Instead it was being set if and only if the ClientHello included some extension other than SNI.

This bug wasn't detected before for two reasons:

    It is rare to have a ClientHello that includes an SNI extension, but no other extensions.

    The code still works correctly if `sni_extension_found` is set even if there is no SNI in the ClientHello.

So, the bug only creates a problem if the browser's ClientHello include an SNI extension and no other extensions (see "BingPreview Jun 2014" in the client_simulation branch).
This commit is contained in:
David Cooper 2017-03-24 11:48:01 -04:00 committed by GitHub
parent faefe62bea
commit 3451083bbd

View File

@ -2129,7 +2129,9 @@ create_client_simulation_tls_clienthello() {
len=$len_extension+8 len=$len_extension+8
tls_extensions+="${tls_handshake_ascii:$offset:$len}" tls_extensions+="${tls_handshake_ascii:$offset:$len}"
offset=$offset+$len offset=$offset+$len
elif [[ -n "$SNI" ]]; then else
sni_extension_found=true
if [[ -n "$SNI" ]]; then
# Create a server name extension that corresponds to $SNI # Create a server name extension that corresponds to $SNI
len_servername=${#NODE} len_servername=${#NODE}
hexdump_format_str="$len_servername/1 \"%02x\"" hexdump_format_str="$len_servername/1 \"%02x\""
@ -2141,6 +2143,7 @@ create_client_simulation_tls_clienthello() {
tls_extensions+="000000${len_sni_ext}00${len_sni_listlen}0000${len_servername_hex}${servername_hexstr}" tls_extensions+="000000${len_sni_ext}00${len_sni_listlen}0000${len_servername_hex}${servername_hexstr}"
offset=$offset+$len_extension+4 offset=$offset+$len_extension+4
fi fi
fi
done done
if ! $sni_extension_found; then if ! $sni_extension_found; then