Bug 934171: Fix OCSP stapling test, r=mcmanus, a=test-only, a=bustage
authorBrian Smith <brian@briansmith.org>
Sat, 02 Nov 2013 19:57:26 -0700
changeset 166514 ca2aaf705a4d3118b028e3138d041da39fd8aa2b
parent 166513 5926bf365a2ecb4aa2b3156369ae11e5a3d5d317
child 166515 eabe00ce2f4041a652c4362737a8df1f39c2e7cb
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus, test-only, bustage
bugs934171
milestone27.0a2
Bug 934171: Fix OCSP stapling test, r=mcmanus, a=test-only, a=bustage
security/manager/ssl/tests/unit/tlsserver/lib/TLSServer.h
--- a/security/manager/ssl/tests/unit/tlsserver/lib/TLSServer.h
+++ b/security/manager/ssl/tests/unit/tlsserver/lib/TLSServer.h
@@ -48,18 +48,20 @@ StartServer(const char *nssCertDBDir, SS
 
 template <typename Host>
 inline const Host *
 GetHostForSNI(const SECItem *aSrvNameArr, uint32_t aSrvNameArrSize,
               const Host *hosts)
 {
   for (uint32_t i = 0; i < aSrvNameArrSize; i++) {
     for (const Host *host = hosts; host->mHostName; ++host) {
-      // TODO: is aSrvNameArr[i].data guaranteed to be null-terminated?
-      if (!strcmp(host->mHostName, (const char *) aSrvNameArr[i].data)) {
+      SECItem hostName;
+      hostName.data = reinterpret_cast<uint8_t*>(const_cast<char*>(host->mHostName));
+      hostName.len = strlen(host->mHostName);
+      if (SECITEM_ItemsAreEqual(&hostName, &aSrvNameArr[i])) {
         if (gDebugLevel >= DEBUG_VERBOSE) {
           fprintf(stderr, "found pre-defined host '%s'\n", host->mHostName);
         }
         return host;
       }
     }
   }