Coverity Fixes #12531
Coverity Fixes #12531
Conversation
crypto/asn1/asn_mime.c
Outdated
Show resolved
Hide resolved
| if (!icont) | ||
| BIO_free(cont); | ||
| return NULL; |
slontis
Jul 26, 2020
Contributor
just do
goto err;
add add label at bottom for the identical code.
err:
This should also be fixed in master
just do
goto err;
add add label at bottom for the identical code.
err:
This should also be fixed in master
ashman-p
Jul 28, 2020
Author
Contributor
Changed.
Changed.
| @@ -58,7 +58,9 @@ int ecdh_KDF_X9_63(unsigned char *out, size_t outlen, | |||
| if (!EVP_DigestFinal(mctx, mtmp, NULL)) | |||
| goto err; | |||
| memcpy(out, mtmp, outlen); | |||
| OPENSSL_cleanse(mtmp, mdlen); | |||
| if (mdlen > 0) { | |||
slontis
Jul 26, 2020
Contributor
I would not do this check here..
move the
mdlen = EVP_MD_size(md);
line above the new and then do a negative there and return 0 instead.
I would not do this check here..
move the
mdlen = EVP_MD_size(md);
line above the new and then do a negative there and return 0 instead.
ashman-p
Jul 28, 2020
Author
Contributor
Changed.
Changed.
| @@ -322,7 +322,7 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, | |||
| tmpout = out; | |||
|
|
|||
| /* We now have to 'read' from p7bio to calculate digests etc. */ | |||
| if ((buf = OPENSSL_malloc(BUFFERSIZE)) == NULL) { | |||
| if ((buf = OPENSSL_zalloc(BUFFERSIZE)) == NULL) { | |||
slontis
Jul 26, 2020
Contributor
not sure I understand why this needs to be done here
not sure I understand why this needs to be done here
ashman-p
Jul 27, 2020
Author
Contributor
The Coverity issue was "String not null terminated". Looking at the details more closely... the bio callbacks used for read and write ends up using strlen which expects the null terminated buffer.
I think we can ignore this one and have it fixed in the callback.
The Coverity issue was "String not null terminated". Looking at the details more closely... the bio callbacks used for read and write ends up using strlen which expects the null terminated buffer.
I think we can ignore this one and have it fixed in the callback.
crypto/rand/drbg_lib.c
Outdated
Show resolved
Hide resolved
| @@ -55,8 +55,10 @@ static ASN1_INTEGER *def_serial_cb(struct TS_resp_ctx *ctx, void *data) | |||
|
|
|||
| if (serial == NULL) | |||
| goto err; | |||
| if (!ASN1_INTEGER_set(serial, 1)) | |||
| if (!ASN1_INTEGER_set(serial, 1)) { | |||
slontis
Jul 26, 2020
Contributor
Move the
ASN1_INTEGER_free(serial);
to the err block (it does this in master)
Move the
ASN1_INTEGER_free(serial);
to the err block (it does this in master)
ashman-p
Jul 28, 2020
Author
Contributor
Changed.
Changed.
| @@ -1151,6 +1151,7 @@ int tls_parse_ctos_psk(SSL *s, PACKET *pkt, unsigned int context, X509 *x, | |||
| if (sesstmp == NULL) { | |||
| SSLfatal(s, SSL_AD_INTERNAL_ERROR, | |||
| SSL_F_TLS_PARSE_CTOS_PSK, ERR_R_INTERNAL_ERROR); | |||
| SSL_SESSION_free(sess); | |||
slontis
Jul 26, 2020
Contributor
use this instead..
goto err:
Needs to go back to master..
use this instead..
goto err:
Needs to go back to master..
ashman-p
Jul 28, 2020
Author
Contributor
Changed.
Changed.
|
Thanks for fixing coverity errors. Any relevant ones that I have listed need to be fixed in master before this PR for 111 will be merged. |
Fixes openssl#12531 on master branch.
Glad to do it. the PR for master was created. |
|
Looks like the test failure is due to a bad cert? openssl x509 -in test/certs/ee-self-signed.pem -noout -text Certificate: |
|
A rebase will fix this.. It has been fixed by @mattcaswell in merged PR #12545 |
This does not appear to be applied to 1.1.1 yet. |
ecdh_kdf.c: Improper use of negative value x_algor .c: Explicit null dereferenced cms_sd .c: Resource leak extensions_srvr.c : Resource leak pk7_smime.c: String not null terminated ts_rsp_sign.c Resource Leak asn_mime.c: Explicit null dereferenced extensions_srvr.c: Resourse Leak v3_alt.c: Resourse Leak pcy_data.c: Resource Leak cms_lib.c: Resource Leak drbg_lib.c: Unchecked return code
Revert files per PR for coverity issues.
crypto/ec/ecdh_kdf.c:36:5: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
if (mdlen < 0)
^
This coverity issus is no longer a problem now that EVP_MD_size() can no longer return -1. Removing ecdh_kdf.c from the PR.
|
Changes have been applied to master. So the hold has been removed. |
|
LGTM |
|
ping |
|
LGTM |
|
ping |
|
Approved if the nit already exists in master. |
| @@ -554,7 +554,9 @@ int rand_drbg_restart(RAND_DRBG *drbg, | |||
| drbg->meth->reseed(drbg, adin, adinlen, NULL, 0); | |||
| } else if (reseeded == 0) { | |||
| /* do a full reseeding if it has not been done yet above */ | |||
| RAND_DRBG_reseed(drbg, NULL, 0, 0); | |||
| if(!RAND_DRBG_reseed(drbg, NULL, 0, 0)) { | |||
mattcaswell
Aug 10, 2020
Member
There's a formatting nit here. Should be if (, i.e. with a space after if and before opening parens. Is this already like this on master? If so then possibly leave it.
There's a formatting nit here. Should be if (, i.e. with a space after if and before opening parens. Is this already like this on master? If so then possibly leave it.
paulidale
Aug 10, 2020
Contributor
drbg_lib.c no longer exists on master.
drbg_lib.c no longer exists on master.
Fixes openssl#12531 on master branch. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from openssl#12557)
|
fixed some spacing NITS |
x_algor.c: Explicit null dereferenced cms_sd.c: Resource leak ts_rsp_sign.c Resource Leak extensions_srvr.c: Resourse Leak v3_alt.c: Resourse Leak pcy_data.c: Resource Leak cms_lib.c: Resource Leak drbg_lib.c: Unchecked return code Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from #12531)
|
Thanks for fixing.. |
ecdh_kdf.c: Improper use of negative value
x_algor .c: Explicit null dereferenced
cms_sd .c: Resource leak
extensions_srvr.c : Resource leak
pk7_smime.c: String not null terminated
ts_rsp_sign.c Resource Leak
asn_mime.c: Explicit null dereferenced
extensions_srvr.c: Resourse Leak
v3_alt.c: Resourse Leak
pcy_data.c: Resource Leak
cms_lib.c: Resource Leak
drbg_lib.c: Unchecked return code
Fixes #12529
Checklist