Skip to content

Commit b0c026e

Browse files
committed
Address CA file parsing problem
.... by forbidding spaces in supplied CA files/directories Also now we're sanitizing the cmd line parameter better `using safe_echo()` See also #2647 .
1 parent e69a29c commit b0c026e

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
* Renegotiation checks improved, also no false positive for Node.js anymore
5555
* Major update of client simulations with self-collected up-to-date data
5656
* Update of CA certificate stores
57-
* Lots of bug fixes
57+
* Lots of bug and security fixes
5858
* More travis/CI checks -- still place for improvements
5959
* Man page reviewed
6060

testssl.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19681,10 +19681,10 @@ debug_globals() {
1968119681
# arg2: value (if no = provided)
1968219682
parse_opt_equal_sign() {
1968319683
if [[ "$1" == *=* ]]; then
19684-
echo ${1#*=}
19684+
safe_echo "${1#*=}"
1968519685
return 1 # = means we don't need to shift args!
1968619686
else
19687-
echo "$2"
19687+
safe_echo "$2"
1968819688
return 0 # we need to shift
1968919689
fi
1969019690
}
@@ -20254,8 +20254,11 @@ parse_cmd_line() {
2025420254
[[ $CMDLINE_IP == one ]] && ( is_ipv4addr "$URI" || is_ipv6addr "$URI" ) && fatal "\"--ip=one\" plus supplying an IP address doesn't work" $ERR_CMDLINE
2025520255
"$do_mx_all_ips" && [[ "$NODNS" == none ]] && fatal "\"--mx\" and \"--nodns=none\" don't work together" $ERR_CMDLINE
2025620256

20257+
if [[ "${ADDITIONAL_CA_FILES}" =~ \ ]]; then
20258+
fatal "The CA file \"${ADDITIONAL_CA_FILES}\" must not contain spaces" $ERR_RESOURCE
20259+
fi
2025720260
ADDITIONAL_CA_FILES="${ADDITIONAL_CA_FILES//,/ }"
20258-
for fname in $ADDITIONAL_CA_FILES; do
20261+
for fname in ${ADDITIONAL_CA_FILES}; do
2025920262
[[ -s "$fname" ]] || fatal "CA file \"$fname\" does not exist" $ERR_RESOURCE
2026020263
grep -q "BEGIN CERTIFICATE" "$fname" || fatal "\"$fname\" is not CA file in PEM format" $ERR_RESOURCE
2026120264
done

0 commit comments

Comments
 (0)