]> git.saurik.com Git - apple/security.git/blobdiff - libsecurity_keychain/lib/Certificate.cpp
Security-55471.14.4.tar.gz
[apple/security.git] / libsecurity_keychain / lib / Certificate.cpp
index 95fdeb1057eba1e529b32eb1f517de2a0d6465fa..0dbc174b007d4d9065608baaabf9f7c7e94fa3bd 100644 (file)
@@ -894,6 +894,8 @@ Certificate::copyDNSNames()
                /* Encoding is kCFStringEncodingUTF8 since the string is either
                   PRINTABLE_STRING, IA5_STRING, T61_STRING or PKIX_UTF8_STRING. */
                CFStringRef string = CFStringCreateWithBytes(NULL, it->Data, static_cast<CFIndex>(it->Length), kCFStringEncodingUTF8, true);
+               /* Be prepared for improperly formatted (non-UTF8) strings! */
+               if (!string) continue;
                CFArrayAppendValue(array, string);
                CFRelease(string);
        }
@@ -932,6 +934,8 @@ Certificate::copyEmailAddresses()
                /* Encoding is kCFStringEncodingUTF8 since the string is either
                   PRINTABLE_STRING, IA5_STRING, T61_STRING or PKIX_UTF8_STRING. */
                CFStringRef string = CFStringCreateWithBytes(NULL, it->Data, static_cast<CFIndex>(it->Length), kCFStringEncodingUTF8, true);
+               /* Be prepared for improperly formatted (non-UTF8) strings! */
+               if (!string) continue;
                CFArrayAppendValue(array, string);
                CFRelease(string);
        }