summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2018-04-19 11:59:42 -0400
committerMark Benvenuto <mark.benvenuto@mongodb.com>2018-04-19 11:59:42 -0400
commit77a1aa2e1b1556c9ba88acd13c7fa1621c24a801 (patch)
tree746085a8310b8563e9592e8de09416287db030e4 /src
parentf769ba3ff8815d4264aa50d5196d450a7b3f9f87 (diff)
downloadmongo-77a1aa2e1b1556c9ba88acd13c7fa1621c24a801.tar.gz
SERVER-34545 Handle empty RDNs in Certificate subject names
Diffstat (limited to 'src')
-rw-r--r--src/mongo/util/net/ssl_manager_apple.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mongo/util/net/ssl_manager_apple.cpp b/src/mongo/util/net/ssl_manager_apple.cpp
index 56d2f5b2b35..eca7ec0bfa4 100644
--- a/src/mongo/util/net/ssl_manager_apple.cpp
+++ b/src/mongo/util/net/ssl_manager_apple.cpp
@@ -76,6 +76,10 @@ static const ::CFAbsoluteTime k20010101_000000_GMT = 978307200;
StatusWith<std::string> toString(::CFStringRef str) {
const auto len =
::CFStringGetMaximumSizeForEncoding(::CFStringGetLength(str), ::kCFStringEncodingUTF8);
+ if (len == 0) {
+ return std::string();
+ }
+
std::string ret;
ret.resize(len + 1);
if (!::CFStringGetCString(str, &ret[0], len, ::kCFStringEncodingUTF8)) {