Skip to content

Commit 7937c0b

Browse files
authored
Merge pull request #2696 from testssl/fix_segfault_error4-3.0
Fix segfault with error 4 in check_revocation_ocsp() when using --phone-out (3.0)
2 parents ab0b829 + 8d01985 commit 7937c0b

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

testssl.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1833,6 +1833,8 @@ check_revocation_ocsp() {
18331833
local -i success
18341834
local response=""
18351835
local host_header=""
1836+
local openssl_bin="$OPENSSL"
1837+
local addtl_warning=""
18361838

18371839
"$PHONE_OUT" || [[ -n "$stapled_response" ]] || return 0
18381840
[[ -n "$GOOD_CA_BUNDLE" ]] || return 0
@@ -1851,6 +1853,16 @@ check_revocation_ocsp() {
18511853
-issuer $TEMPDIR/hostcert_issuer.pem -verify_other $TEMPDIR/intermediatecerts.pem \
18521854
-CAfile <(cat $ADDITIONAL_CA_FILES "$GOOD_CA_BUNDLE") -cert $HOSTCERT -text &> "$tmpfile"
18531855
else
1856+
if [[ $OPENSSL =~ openssl.Linux.$(uname -m) ]]; then
1857+
# --phone-out doesn't lawyas work with "our" binary. We use just for that purpose
1858+
# the vendor supplied binary if available, see #2516 and probably also #2667 and #1275
1859+
if [[ -x "$OPENSSL2" ]]; then
1860+
openssl_bin="$OPENSSL2"
1861+
[[ $DEBUG -ge 3 ]] && echo "Switching to $openssl_bin "
1862+
fi
1863+
else
1864+
addtl_warning="(a segfault indicates here you need to test this with another binary)"
1865+
fi
18541866
host_header=${uri##http://}
18551867
host_header=${host_header%%/*}
18561868
if [[ "$OSSL_NAME" =~ LibreSSL ]]; then
@@ -1861,7 +1873,7 @@ check_revocation_ocsp() {
18611873
else
18621874
host_header="-header Host ${host_header}"
18631875
fi
1864-
$OPENSSL ocsp -no_nonce ${host_header} -url "$uri" \
1876+
$openssl_bin ocsp -no_nonce ${host_header} -url "$uri" \
18651877
-issuer $TEMPDIR/hostcert_issuer.pem -verify_other $TEMPDIR/intermediatecerts.pem \
18661878
-CAfile <(cat $ADDITIONAL_CA_FILES "$GOOD_CA_BUNDLE") -cert $HOSTCERT -text &> "$tmpfile"
18671879
fi
@@ -1879,8 +1891,8 @@ check_revocation_ocsp() {
18791891
fileout "$jsonID" "CRITICAL" "revoked"
18801892
else
18811893
out ", "
1882-
pr_warning "error querying OCSP responder"
1883-
fileout "$jsonID" "WARN" "$response"
1894+
pr_warning "error querying OCSP responder $addtl_warning"
1895+
fileout "$jsonID" "WARN" "$response $addtl_warning"
18841896
if [[ $DEBUG -ge 2 ]]; then
18851897
outln
18861898
cat "$tmpfile"

0 commit comments

Comments
 (0)