diff options
author | wtc%netscape.com <devnull@localhost> | 2003-01-17 02:49:11 +0000 |
---|---|---|
committer | wtc%netscape.com <devnull@localhost> | 2003-01-17 02:49:11 +0000 |
commit | 47da54b403f4a0a6c71da4c75f150407b875a9ef (patch) | |
tree | bf72249f0b444f70048fb7055cf3fdabad5f8eed | |
parent | 4008f0f9011d23d46f9c5734bb86655c7fbf8fd8 (diff) | |
download | nss-hg-47da54b403f4a0a6c71da4c75f150407b875a9ef.tar.gz |
Bug 145029: fixed compiler warnings (mostly "xxx might be used
uninitialized").
-rw-r--r-- | security/nss/cmd/certutil/certutil.c | 2 | ||||
-rw-r--r-- | security/nss/cmd/signtool/certgen.c | 3 | ||||
-rw-r--r-- | security/nss/cmd/signtool/javascript.c | 5 | ||||
-rw-r--r-- | security/nss/cmd/signtool/sign.c | 2 | ||||
-rw-r--r-- | security/nss/cmd/signtool/signtool.c | 8 | ||||
-rw-r--r-- | security/nss/cmd/smimetools/cmsutil.c | 23 | ||||
-rw-r--r-- | security/nss/cmd/strsclnt/strsclnt.c | 5 | ||||
-rw-r--r-- | security/nss/lib/cryptohi/dsautil.c | 5 | ||||
-rw-r--r-- | security/nss/lib/pk11wrap/pk11cert.c | 3 | ||||
-rw-r--r-- | security/nss/lib/smime/cmsrecinfo.c | 3 | ||||
-rw-r--r-- | security/nss/lib/smime/smimeutil.c | 11 | ||||
-rw-r--r-- | security/nss/lib/softoken/dbmshim.c | 5 | ||||
-rw-r--r-- | security/nss/lib/softoken/pcertdb.c | 3 | ||||
-rw-r--r-- | security/nss/lib/softoken/pkcs11.c | 2 |
14 files changed, 35 insertions, 45 deletions
diff --git a/security/nss/cmd/certutil/certutil.c b/security/nss/cmd/certutil/certutil.c index 1c714f854..94f26d071 100644 --- a/security/nss/cmd/certutil/certutil.c +++ b/security/nss/cmd/certutil/certutil.c @@ -1590,7 +1590,7 @@ AddSubjectAltNames(void *extHandle, const char *names, CERTGeneralNameType type) { SECItem item = { 0, NULL, 0 }; CERTGeneralName *nameList = NULL; - CERTGeneralName *current; + CERTGeneralName *current = NULL; PRCList *prev = NULL; PRArenaPool *arena; const char *cp; diff --git a/security/nss/cmd/signtool/certgen.c b/security/nss/cmd/signtool/certgen.c index 00222044d..724ce93e1 100644 --- a/security/nss/cmd/signtool/certgen.c +++ b/security/nss/cmd/signtool/certgen.c @@ -425,7 +425,7 @@ sign_cert(CERTCertificate *cert, SECKEYPrivateKey *privk) SECItem *result2; void *dummy; - SECOidTag alg; + SECOidTag alg = SEC_OID_UNKNOWN; switch (privk->keyType) { @@ -439,6 +439,7 @@ sign_cert(CERTCertificate *cert, SECKEYPrivateKey *privk) default: FatalError("Unknown key type"); } + PORT_Assert(alg != SEC_OID_UNKNOWN); rv = SECOID_SetAlgorithmID (cert->arena, &cert->signature, alg, 0); diff --git a/security/nss/cmd/signtool/javascript.c b/security/nss/cmd/signtool/javascript.c index 26bf39f9b..142a9751a 100644 --- a/security/nss/cmd/signtool/javascript.c +++ b/security/nss/cmd/signtool/javascript.c @@ -314,7 +314,7 @@ ProcessTag(FileBuffer* fb, char **errStr) int curchar; TagItem *ti=NULL; AVPair *curPair=NULL; - char quotechar; + char quotechar='\0'; unsigned int linenum; unsigned int startline; @@ -530,12 +530,14 @@ ProcessTag(FileBuffer* fb, char **errStr) /* quoted value. Start recording the value inside the quote*/ startID = FB_GetPointer(fb); state = GET_QUOTED_VAL_STATE; + PORT_Assert(quotechar == '\0'); quotechar = curchar; /* look for matching quote type */ } else { /* just more value */ } break; case GET_QUOTED_VAL_STATE: + PORT_Assert(quotechar != '\0'); if(curchar == quotechar) { /* end of quoted value */ curPos = FB_GetPointer(fb)-2; @@ -547,6 +549,7 @@ ProcessTag(FileBuffer* fb, char **errStr) /* empty value, leave it as NULL */ } state = GET_ATT_STATE; + quotechar = '\0'; startID = FB_GetPointer(fb); } else { /* more quoted value, continue */ diff --git a/security/nss/cmd/signtool/sign.c b/security/nss/cmd/signtool/sign.c index 4f909d40c..ae732644a 100644 --- a/security/nss/cmd/signtool/sign.c +++ b/security/nss/cmd/signtool/sign.c @@ -675,7 +675,7 @@ static int generate_SF_file (char *manifile, char *who) long r1, r2, r3; char whofile [FNSIZE]; - char *buf, *name; + char *buf, *name = NULL; JAR_Digest dig; diff --git a/security/nss/cmd/signtool/signtool.c b/security/nss/cmd/signtool/signtool.c index 81de9c8b4..77f55980b 100644 --- a/security/nss/cmd/signtool/signtool.c +++ b/security/nss/cmd/signtool/signtool.c @@ -287,7 +287,7 @@ parse_args(int argc, char *argv[]) { char *opt; char *arg; - int needsInc; + int needsInc = 0; int i; OPT_TYPE type; @@ -303,7 +303,6 @@ parse_args(int argc, char *argv[]) needsInc = 1; arg = argv[i+1]; } else { - needsInc = 0; arg = NULL; } @@ -327,13 +326,11 @@ parse_args(int argc, char *argv[]) } else { /* char option */ if(opt[2]!='\0') { - needsInc = 0; arg = opt+2; } else if(i < argc-1) { needsInc = 1; arg = argv[i+1]; } else { - needsInc = 0; arg = NULL; } @@ -422,8 +419,8 @@ parse_args(int argc, char *argv[]) } } } else { + type = UNKNOWN_OPT; if(i == argc-1) { - type = UNKNOWN_OPT; if(jartree) { PR_fprintf(errorFD, "warning: directory to be signed specified more than once." @@ -433,7 +430,6 @@ parse_args(int argc, char *argv[]) } jartree = PL_strdup(opt); } else { - type = UNKNOWN_OPT; PR_fprintf(errorFD, "warning: unrecognized option: %s\n", opt); warningCount++; } diff --git a/security/nss/cmd/smimetools/cmsutil.c b/security/nss/cmd/smimetools/cmsutil.c index b99d6baaf..e2bfc39b5 100644 --- a/security/nss/cmd/smimetools/cmsutil.c +++ b/security/nss/cmd/smimetools/cmsutil.c @@ -227,7 +227,6 @@ decode(FILE *out, SECItem *output, SECItem *input, if (decodeOptions->contentFile) { /* detached content: grab content file */ SECU_FileToItem(&sitem, decodeOptions->contentFile); - item = &sitem; } dcx = NSS_CMSDecoder_Start(NULL, @@ -273,7 +272,7 @@ decode(FILE *out, SECItem *output, SECItem *input, goto loser; } digestalgs = NSS_CMSSignedData_GetDigestAlgs(sigd); - if (DigestFile (poolp, &digests, item, digestalgs) + if (DigestFile (poolp, &digests, &sitem, digestalgs) != SECSuccess) { SECU_PrintError(progName, "problem computing message digest"); @@ -365,8 +364,8 @@ decode(FILE *out, SECItem *output, SECItem *input, } if (!decodeOptions->suppressContent) { - if (!decodeOptions->contentFile) - item = NSS_CMSMessage_GetContent(cmsg); + item = decodeOptions->contentFile ? &sitem : + NSS_CMSMessage_GetContent(cmsg); SECITEM_CopyItem(NULL, output, item); } @@ -733,9 +732,6 @@ get_enc_params(struct encryptOptionsStr *encryptOptions) SECStatus rv = SECFailure; NSSCMSMessage *env_cmsg; NSSCMSContentInfo *cinfo; - PK11SymKey *bulkkey = NULL; - SECOidTag bulkalgtag; - int keysize; int i, nlevels; /* * construct an enveloped data message to obtain bulk keys @@ -768,21 +764,16 @@ get_enc_params(struct encryptOptionsStr *encryptOptions) /* * get the symmetric key */ - bulkalgtag = NSS_CMSContentInfo_GetContentEncAlgTag(cinfo); - keysize = NSS_CMSContentInfo_GetBulkKeySize(cinfo); - bulkkey = NSS_CMSContentInfo_GetBulkKey(cinfo); + encryptOptions->bulkalgtag = NSS_CMSContentInfo_GetContentEncAlgTag(cinfo); + encryptOptions->keysize = NSS_CMSContentInfo_GetBulkKeySize(cinfo); + encryptOptions->bulkkey = NSS_CMSContentInfo_GetBulkKey(cinfo); + rv = SECSuccess; break; } } if (i == nlevels) { fprintf(stderr, "%s: could not retrieve enveloped data.", progName); - goto loser; } - encryptOptions->bulkalgtag = bulkalgtag; - encryptOptions->bulkkey = bulkkey; - encryptOptions->keysize = keysize; - rv = SECSuccess; -loser: if (env_cmsg) NSS_CMSMessage_Destroy(env_cmsg); return rv; diff --git a/security/nss/cmd/strsclnt/strsclnt.c b/security/nss/cmd/strsclnt/strsclnt.c index 068d60830..ff087c747 100644 --- a/security/nss/cmd/strsclnt/strsclnt.c +++ b/security/nss/cmd/strsclnt/strsclnt.c @@ -385,8 +385,7 @@ launch_thread( PR_WaitCondVar(threadStartQ, PR_INTERVAL_NO_TIMEOUT); } for (i = 0; i < numUsed; ++i) { - slot = threads + i; - if (slot->running == rs_idle) + if (threads[i].running == rs_idle) break; } if (i >= numUsed) { @@ -398,9 +397,9 @@ launch_thread( } ++numUsed; PORT_Assert(numUsed == i + 1); - slot = threads + i; } + slot = threads + i; slot->a = a; slot->b = b; slot->c = c; diff --git a/security/nss/lib/cryptohi/dsautil.c b/security/nss/lib/cryptohi/dsautil.c index c592ec7df..504e69907 100644 --- a/security/nss/lib/cryptohi/dsautil.c +++ b/security/nss/lib/cryptohi/dsautil.c @@ -66,10 +66,9 @@ DSAU_ConvertUnsignedToSigned(SECItem *dest, SECItem *src) unsigned char *pSrc = src->data; unsigned char *pDst = dest->data; unsigned int cntSrc = src->len; - unsigned char c; /* skip any leading zeros. */ - while (cntSrc && !(c = *pSrc)) { + while (cntSrc && !(*pSrc)) { pSrc++; cntSrc--; } @@ -79,7 +78,7 @@ DSAU_ConvertUnsignedToSigned(SECItem *dest, SECItem *src) return; } - if (c & 0x80) + if (*pSrc & 0x80) *pDst++ = 0; PORT_Memcpy(pDst, pSrc, cntSrc); diff --git a/security/nss/lib/pk11wrap/pk11cert.c b/security/nss/lib/pk11wrap/pk11cert.c index 04aa5fca4..be06ceae9 100644 --- a/security/nss/lib/pk11wrap/pk11cert.c +++ b/security/nss/lib/pk11wrap/pk11cert.c @@ -2261,7 +2261,7 @@ pk11_AllFindCertObjectByRecipient(PK11SlotInfo **slotPtr, void *wincx) { PK11SlotList *list; PK11SlotListElement *le; - CERTCertificate * cert; + CERTCertificate * cert = NULL; PK11SlotInfo *slot = NULL; SECStatus rv; @@ -2297,6 +2297,7 @@ pk11_AllFindCertObjectByRecipient(PK11SlotInfo **slotPtr, return NULL; } *slotPtr = slot; + PORT_Assert(cert != NULL); return cert; } diff --git a/security/nss/lib/smime/cmsrecinfo.c b/security/nss/lib/smime/cmsrecinfo.c index 01211cfce..bd1a0a34a 100644 --- a/security/nss/lib/smime/cmsrecinfo.c +++ b/security/nss/lib/smime/cmsrecinfo.c @@ -406,7 +406,7 @@ NSS_CMSRecipientInfo_WrapBulkKey(NSSCMSRecipientInfo *ri, PK11SymKey *bulkkey, NSSCMSOriginatorIdentifierOrKey *oiok; CERTSubjectPublicKeyInfo *spki, *freeSpki = NULL; PLArenaPool *poolp; - NSSCMSKeyTransRecipientInfoEx *extra; + NSSCMSKeyTransRecipientInfoEx *extra = NULL; PRBool usesSubjKeyID; poolp = ri->cmsg->poolp; @@ -443,6 +443,7 @@ NSS_CMSRecipientInfo_WrapBulkKey(NSSCMSRecipientInfo *ri, PK11SymKey *bulkkey, if (rv != SECSuccess) break; } else if (usesSubjKeyID) { + PORT_Assert(extra != NULL); rv = NSS_CMSUtil_EncryptSymKey_RSAPubKey(poolp, extra->pubKey, bulkkey, &ri->ri.keyTransRecipientInfo.encKey); if (rv != SECSuccess) diff --git a/security/nss/lib/smime/smimeutil.c b/security/nss/lib/smime/smimeutil.c index 3ef977d32..6564db294 100644 --- a/security/nss/lib/smime/smimeutil.c +++ b/security/nss/lib/smime/smimeutil.c @@ -237,7 +237,6 @@ nss_smime_get_cipher_for_alg_and_key(SECAlgorithmID *algid, PK11SymKey *key, uns { SECOidTag algtag; unsigned int keylen_bits; - SECStatus rv = SECSuccess; unsigned long c; algtag = SECOID_GetAlgorithmTag(algid); @@ -255,8 +254,7 @@ nss_smime_get_cipher_for_alg_and_key(SECAlgorithmID *algid, PK11SymKey *key, uns c = SMIME_RC2_CBC_128; break; default: - rv = SECFailure; - break; + return SECFailure; } break; case SEC_OID_DES_CBC: @@ -269,11 +267,10 @@ nss_smime_get_cipher_for_alg_and_key(SECAlgorithmID *algid, PK11SymKey *key, uns c = SMIME_FORTEZZA; break; default: - rv = SECFailure; + return SECFailure; } - if (rv == SECSuccess) - *cipher = c; - return rv; + *cipher = c; + return SECSuccess; } static PRBool diff --git a/security/nss/lib/softoken/dbmshim.c b/security/nss/lib/softoken/dbmshim.c index 935780dbf..a085765c6 100644 --- a/security/nss/lib/softoken/dbmshim.c +++ b/security/nss/lib/softoken/dbmshim.c @@ -365,7 +365,7 @@ dbs_readBlob(DBS *dbsp, DBT *data) PRFileMap *mapfile = NULL; unsigned char *addr = NULL; int error; - int len; + int len = -1; file = dbs_getBlobFilePath(dbsp->blobdir, data); if (!file) { @@ -405,9 +405,10 @@ loser: error = PR_GetError(); if (addr) { if (mapfile) { + PORT_Assert(len != -1); PR_MemUnmap(addr,len); } else { - PORT_Free(addr); + PORT_Free(addr); } } if (mapfile) { diff --git a/security/nss/lib/softoken/pcertdb.c b/security/nss/lib/softoken/pcertdb.c index e61f9f831..83a905b6b 100644 --- a/security/nss/lib/softoken/pcertdb.c +++ b/security/nss/lib/softoken/pcertdb.c @@ -3486,7 +3486,6 @@ UpdateV7DB(NSSLOWCERTCertDBHandle *handle, DB *updatedb) case certDBEntryTypeSubject: case certDBEntryTypeContentVersion: case certDBEntryTypeNickname: - /*default: */ break; case certDBEntryTypeCert: @@ -3547,6 +3546,8 @@ UpdateV7DB(NSSLOWCERTCertDBHandle *handle, DB *updatedb) PORT_FreeArena(smimeEntry.common.arena, PR_FALSE); smimeEntry.common.arena = NULL; break; + default: + break; } } while ( (* updatedb->seq)(updatedb, &key, &data, R_NEXT) == 0 ); diff --git a/security/nss/lib/softoken/pkcs11.c b/security/nss/lib/softoken/pkcs11.c index 64491b2c8..90809a9c4 100644 --- a/security/nss/lib/softoken/pkcs11.c +++ b/security/nss/lib/softoken/pkcs11.c @@ -1985,7 +1985,7 @@ pk11_IsWeakKey(unsigned char *key,CK_KEY_TYPE key_type) static NSSLOWKEYPrivateKey * pk11_mkSecretKeyRep(PK11Object *object) { - NSSLOWKEYPrivateKey *privKey; + NSSLOWKEYPrivateKey *privKey = 0; PLArenaPool *arena = 0; CK_RV crv; SECStatus rv; |