summaryrefslogtreecommitdiff
path: root/external/nss/ubsan.patch.0
blob: 1cdf694f43453cc234c63616543b75d8f2892c02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
--- 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;