--- nss/lib/certdb/crl.c +++ nss/lib/certdb/crl.c @@ -1982,7 +1982,7 @@ return SECSuccess; } /* all CRLs are good, sort them by thisUpdate */ - qsort(cache->crls, cache->ncrls, sizeof(CachedCrl*), SortCRLsByThisUpdate); + if (cache->ncrls != 0) qsort(cache->crls, cache->ncrls, sizeof(CachedCrl*), SortCRLsByThisUpdate); if (cache->ncrls) { /* pick the newest CRL */ --- nss/lib/softoken/legacydb/pk11db.c +++ nss/lib/softoken/legacydb/pk11db.c @@ -58,7 +58,7 @@ unsigned char isModuleDBOnly; unsigned char isCritical; unsigned char reserved[4]; - unsigned char names[6]; /* enough space for the length fields */ + unsigned char names[1]; /* +5: enough space for the length fields */ }; struct lgdbSlotDataStr { @@ -139,7 +139,7 @@ goto loser; } - dataLen = sizeof(lgdbData) + len + len2 + len3 + sizeof(unsigned short) + + dataLen = sizeof(lgdbData)+5 + len + len2 + len3 + sizeof(unsigned short) + count*sizeof(lgdbSlotData); data->data = (unsigned char *) PORT_ZAlloc(dataLen); @@ -319,7 +319,7 @@ } if ((encoded->major == LGDB_DB_EXT1_VERSION_MAJOR) && (encoded->minor >= LGDB_DB_EXT1_VERSION_MINOR)) { - CHECK_SIZE( sizeof(lgdbData)); + CHECK_SIZE( sizeof(lgdbData)+5); trustOrder = LGDB_GETLONG(encoded->trustOrder); cipherOrder = LGDB_GETLONG(encoded->cipherOrder); isModuleDB = (encoded->isModuleDB != 0) ? PR_TRUE: PR_FALSE;