src: account for OpenSSL unexpected version
Refs https://github.com/nodejs/node/pull/53456
Fixes a crash present in Electron after ingesting the above PR. This happened because the logic to parse for an OpenSSL version didn't account for OpenSSL_version
returning a value that doesn't match the expected pattern of OpenSSL 1.1.0i 14 Aug 2018
. In Electron's case, OpenSSL_version
returns just BoringSSL
, which in combination with the search
logic not accounting for the delimiter not being present caused an out-of-bounds crash:
out_of_range was thrown in -fno-exceptions mode with message "basic_string"
This fixes that by checking for the null terminator and returning 0.0.0
when the target delimiter isn't present.