From d0256e1afc1ba721e98f377d8925e7b7282f5a99 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Thu, 9 Jan 2020 21:39:28 +0100 Subject: Be more consistent about decoding IP addresses in PSM. --- security/manager/ssl/TransportSecurityInfo.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'security/manager/ssl/TransportSecurityInfo.cpp') diff --git a/security/manager/ssl/TransportSecurityInfo.cpp b/security/manager/ssl/TransportSecurityInfo.cpp index 3c7023302..3f4bf4a90 100644 --- a/security/manager/ssl/TransportSecurityInfo.cpp +++ b/security/manager/ssl/TransportSecurityInfo.cpp @@ -8,6 +8,7 @@ #include "PSMRunnable.h" #include "mozilla/Casting.h" +#include "mozilla/net/DNS.h" #include "nsComponentManagerUtils.h" #include "nsIArray.h" #include "nsICertOverrideService.h" @@ -681,8 +682,10 @@ GetSubjectAltNames(CERTCertificate* nssCert, nsString& allNames) case certIPAddress: { - char buf[INET6_ADDRSTRLEN]; + // According to DNS.h, this includes space for the null-terminator + char buf[net::kNetAddrMaxCStrBufSize] = {0}; PRNetAddr addr; + memset(&addr, 0, sizeof(addr)); if (current->name.other.len == 4) { addr.inet.family = PR_AF_INET; memcpy(&addr.inet.ip, current->name.other.data, current->name.other.len); -- cgit v1.2.3