Skip to content

Commit 21d0910

Browse files
authored
Merge pull request #1781 from drwetter/fix_1779_3.1dev
Fix reading SSLv2 socket
2 parents ac99fbe + 3a15383 commit 21d0910

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

testssl.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14300,7 +14300,7 @@ sslv2_sockets() {
1430014300
local cipher_suites="$1"
1430114301
local client_hello len_client_hello
1430214302
local len_ciph_suites_byte len_ciph_suites
14303-
local server_hello sock_reply_file2
14303+
local server_hello sock_reply_file2 foo
1430414304
local -i response_len server_hello_len
1430514305
local parse_complete=false
1430614306

@@ -14355,7 +14355,8 @@ sslv2_sockets() {
1435514355
if [[ -s "$SOCK_REPLY_FILE" ]]; then
1435614356
server_hello=$(hexdump -v -e '16/1 "%02X"' "$SOCK_REPLY_FILE")
1435714357
server_hello_len=$((2 + $(hex2dec "${server_hello:1:3}") ))
14358-
response_len=$(count_chars "$SOCK_REPLY_FILE")
14358+
foo="$(wc -c "$SOCK_REPLY_FILE")"
14359+
response_len="${foo% *}"
1435914360
for (( 1; response_len < server_hello_len; 1 )); do
1436014361
sock_reply_file2=${SOCK_REPLY_FILE}.2
1436114362
mv "$SOCK_REPLY_FILE" "$sock_reply_file2"
@@ -14367,10 +14368,12 @@ sslv2_sockets() {
1436714368
[[ ! -s "$SOCK_REPLY_FILE" ]] && break
1436814369
cat "$SOCK_REPLY_FILE" >> "$sock_reply_file2"
1436914370
mv "$sock_reply_file2" "$SOCK_REPLY_FILE"
14370-
response_len=$(count_chars "$SOCK_REPLY_FILE")
14371+
foo="$(wc -c "$SOCK_REPLY_FILE")"
14372+
response_len="${foo% *}"
1437114373
done
1437214374
fi
1437314375
fi
14376+
1437414377
debugme echo "reading server hello... "
1437514378
if [[ "$DEBUG" -ge 4 ]]; then
1437614379
hexdump -C "$SOCK_REPLY_FILE" | head -6

0 commit comments

Comments
 (0)