-
Notifications
You must be signed in to change notification settings - Fork 840
Clam 2296 coverity regressions #891
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c7f529f
659eced
2e69cde
af27c0a
865a93a
30cada2
0246386
d04daab
526c6b6
d968cd2
c8fcabe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,7 +86,7 @@ static unsigned char *cli_decodesig(const char *sig, unsigned int plen, BIGNUM * | |
| int i, slen = strlen(sig), dec; | ||
| unsigned char *plain = NULL, *ret_sig = NULL; | ||
| BIGNUM *r = NULL, *p = NULL, *c = NULL; | ||
| BN_CTX *bn_ctx; | ||
| BN_CTX *bn_ctx = NULL; | ||
| unsigned int bn_bytes; | ||
| ; | ||
|
|
||
|
|
@@ -331,7 +331,8 @@ cl_error_t cli_versig(const char *md5, const char *dsig) | |
| #define BLK_LEN (PAD_LEN - HASH_LEN - 1) | ||
| int cli_versig2(const unsigned char *sha256, const char *dsig_str, const char *n_str, const char *e_str) | ||
| { | ||
| unsigned char *decoded, digest1[HASH_LEN], digest2[HASH_LEN], digest3[HASH_LEN], *salt; | ||
| unsigned char *decoded = NULL; | ||
| unsigned char digest1[HASH_LEN], digest2[HASH_LEN], digest3[HASH_LEN], *salt; | ||
| unsigned char mask[BLK_LEN], data[BLK_LEN], final[8 + 2 * HASH_LEN], c[4]; | ||
| unsigned int i, rounds; | ||
| void *ctx; | ||
|
|
@@ -360,8 +361,8 @@ int cli_versig2(const unsigned char *sha256, const char *dsig_str, const char *n | |
| } | ||
|
|
||
| if (decoded[PAD_LEN - 1] != 0xbc) { | ||
| free(decoded); | ||
| ret = CL_EVERIFY; | ||
| goto done; | ||
| } | ||
| BN_free(n); | ||
| BN_free(e); | ||
|
|
@@ -372,6 +373,7 @@ int cli_versig2(const unsigned char *sha256, const char *dsig_str, const char *n | |
| memcpy(mask, decoded, BLK_LEN); | ||
| memcpy(digest2, &decoded[BLK_LEN], HASH_LEN); | ||
| free(decoded); | ||
| decoded = NULL; | ||
|
|
||
| c[0] = c[1] = 0; | ||
| rounds = (BLK_LEN + HASH_LEN - 1) / HASH_LEN; | ||
|
|
@@ -417,6 +419,7 @@ int cli_versig2(const unsigned char *sha256, const char *dsig_str, const char *n | |
| return memcmp(digest1, digest2, HASH_LEN) ? CL_EVERIFY : CL_SUCCESS; | ||
|
|
||
| done: | ||
| free(decoded); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is specified in the man page to not do anything if 'decoded' is NULL. Are there any platforms that do not honor this? Should we add a test just to be safe?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I used to be superstitious about this, but from what I can tell it's safe everywhere if the pointer is NULL. |
||
| BN_free(n); | ||
| BN_free(e); | ||
| return ret; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.