Bug 1228332 - Fix a potentially uninitialized pointer read, flagged by static analysis. r=spohl

This commit is contained in:
Bogdan Postelnicu 2015-12-14 07:00:00 +01:00
parent 0610494cbd
commit 014e9f4948

View File

@ -343,6 +343,11 @@ int main(int argc, char **argv) {
#if (defined(XP_WIN) || defined(XP_MACOSX)) && !defined(MAR_NSS) #if (defined(XP_WIN) || defined(XP_MACOSX)) && !defined(MAR_NSS)
rv = mar_read_entire_file(DERFilePaths[k], MAR_MAX_CERT_SIZE, rv = mar_read_entire_file(DERFilePaths[k], MAR_MAX_CERT_SIZE,
&certBuffers[k], &fileSizes[k]); &certBuffers[k], &fileSizes[k]);
if (rv) {
fprintf(stderr, "ERROR: could not read file %s", DERFilePaths[k]);
break;
}
#else #else
/* It is somewhat circuitous to look up a CERTCertificate and then pass /* It is somewhat circuitous to look up a CERTCertificate and then pass
* in its DER encoding just so we can later re-create that * in its DER encoding just so we can later re-create that
@ -358,12 +363,10 @@ int main(int argc, char **argv) {
fileSizes[k] = certs[k]->derCert.len; fileSizes[k] = certs[k]->derCert.len;
} else { } else {
rv = -1; rv = -1;
} fprintf(stderr, "ERROR: could not find cert from nickname %s", certNames[k]);
#endif
if (rv) {
fprintf(stderr, "ERROR: could not read file %s", DERFilePaths[k]);
break; break;
} }
#endif
} }
if (!rv) { if (!rv) {