2
0
mirror of https://github.com/mozilla/cipherscan.git synced 2024-11-05 07:23:42 +01:00

Refuse to proceed if the final argument starts with a hyphen.

This detects and prevents a specific category of user error, where an
incomplete cipherscan command line ending in an OpenSSL -option results
in cipherscan attempting to scan the target '-option:443'.
This commit is contained in:
Richard Soderberg 2015-09-05 01:01:19 -07:00
parent 3f3e22b09a
commit 28555b03f0

View File

@ -1359,6 +1359,14 @@ if [[ "$HOST" = "$PORT" ]]; then
PORT=443
fi
# Refuse to proceed if the hostname starts with a hyphen, since hostnames can't
# begin with a hyphen and this likely means we accidentally parsed an option as
# a hostname.
if [[ $HOST =~ ^- ]]; then
echo "The final argument '$TEMPTARGET' begins with a hyphen '-', which is not a valid HOST[:PORT]." 1>&2
exit 1
fi
debug "host: $HOST"
debug "Port: $PORT"