diff options
author | Jack Magne <jmagne@dhcp-16-206.sjc.redhat.com> | 2016-06-06 16:36:16 -0700 |
---|---|---|
committer | Jack Magne <jmagne@dhcp-16-206.sjc.redhat.com> | 2016-06-17 14:38:11 -0700 |
commit | ff1b164d033870ad7c708d13f671587f93c50749 (patch) | |
tree | e0b4590472c2f9da6554f28276a6fe6cae685693 /base/native-tools | |
parent | bd18c3395671dbf586214709d62246e70fba5e2a (diff) | |
download | pki-ff1b164d033870ad7c708d13f671587f93c50749.tar.gz pki-ff1b164d033870ad7c708d13f671587f93c50749.tar.xz pki-ff1b164d033870ad7c708d13f671587f93c50749.zip |
Fix coverity warnings for 'tkstool'
Issues listed in the ticket addressed by this patch.
Ticket #1199 : Fix coverity warnings for 'tkstool'.
Diffstat (limited to 'base/native-tools')
-rw-r--r-- | base/native-tools/src/tkstool/secutil.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/base/native-tools/src/tkstool/secutil.c b/base/native-tools/src/tkstool/secutil.c index 9cf2c37dc..c31ce9b0b 100644 --- a/base/native-tools/src/tkstool/secutil.c +++ b/base/native-tools/src/tkstool/secutil.c @@ -668,7 +668,7 @@ SECU_ReadDERFromFile(SECItem *der, PRFileDesc *inFile, PRBool ascii) SECStatus rv; if (ascii) { /* First convert ascii to binary */ - SECItem filedata; + SECItem filedata = {siBuffer,0}; char *asc, *body; /* Read in ascii data */ @@ -1419,7 +1419,7 @@ SECU_PrintAlgorithmID(FILE *out, SECAlgorithmID *a, char *m, int level) { SECU_PrintObjectID(out, &a->algorithm, m, level); - if (a->parameters.len == 0 + if (a == NULL || a->parameters.len == 0 || (a->parameters.len == 2 && PORT_Memcmp(a->parameters.data, "\005\000", 2) == 0)) { /* No arguments or NULL argument */ @@ -2471,6 +2471,10 @@ static void secu_PrintPKCS7EncContent(FILE *out, SEC_PKCS7EncryptedContentInfo *src, char *m, int level) { + if (src == NULL) { + fprintf(out,"Invalid input to secu_PrintPKCS7EncContent!\n"); + return; + } if (src->contentTypeTag == NULL) src->contentTypeTag = SECOID_FindOID(&(src->contentType)); @@ -3074,16 +3078,23 @@ SECU_ParseCommandLine(int argc, char **argv, char *progName, secuCommand *cmd) if (optstate->value) { cmd->options[i].arg = (char *)optstate->value; } else if (cmd->options[i].needsArg) { - return SECFailure; + status = PL_OPT_BAD; + goto done; } found = PR_TRUE; break; } } - if (!found) - return SECFailure; + if (!found) { + status = PL_OPT_BAD; + goto done; + } } +done: + + if (optstring != NULL) + free(optstring); if (status == PL_OPT_BAD) return SECFailure; return SECSuccess; |