The branch master has been updated via ef9f6066998718ae904fc10d46205d67aad9aebe (commit) via 71d1b229e9bc230afaea64f03833329f82f6e488 (commit) via 909f2e59832f041cdd0be538f9225f7f3061604a (commit) from 925795995018bddb053e863db8b5c52d2a9005d9 (commit)
- Log ----------------------------------------------------------------- commit ef9f6066998718ae904fc10d46205d67aad9aebe Author: Pauli <paul.d...@oracle.com> Date: Sun Feb 24 21:27:02 2019 +1000 CID 1442838: API usage errors Reviewed-by: Bernd Edlinger <bernd.edlin...@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/8318) commit 71d1b229e9bc230afaea64f03833329f82f6e488 Author: Pauli <paul.d...@oracle.com> Date: Sun Feb 24 21:26:39 2019 +1000 CID 1442835: Integer Overflow Reviewed-by: Bernd Edlinger <bernd.edlin...@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/8318) commit 909f2e59832f041cdd0be538f9225f7f3061604a Author: Pauli <paul.d...@oracle.com> Date: Sun Feb 24 21:26:20 2019 +1000 CID 1442836: Resource leaks Reviewed-by: Bernd Edlinger <bernd.edlin...@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/8318) ----------------------------------------------------------------------- Summary of changes: crypto/property/property.c | 3 ++- crypto/property/property_parse.c | 2 +- test/property_test.c | 6 ++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/crypto/property/property.c b/crypto/property/property.c index dea0dfd..e4fdc68 100644 --- a/crypto/property/property.c +++ b/crypto/property/property.c @@ -143,11 +143,12 @@ static void alg_cleanup(size_t idx, ALGORITHM *a) OSSL_METHOD_STORE *ossl_method_store_new(void) { - OSSL_METHOD_STORE *res = OPENSSL_zalloc(sizeof(*res)); + OSSL_METHOD_STORE *res; if (!RUN_ONCE(&method_store_init_flag, do_method_store_init)) return 0; + res = OPENSSL_zalloc(sizeof(*res)); if (res != NULL) { if ((res->algs = ossl_sa_ALGORITHM_new()) == NULL) { OPENSSL_free(res); diff --git a/crypto/property/property_parse.c b/crypto/property/property_parse.c index 2094d38..074da51 100644 --- a/crypto/property/property_parse.c +++ b/crypto/property/property_parse.c @@ -301,7 +301,7 @@ static OSSL_PROPERTY_LIST *stack_to_property_list(STACK_OF(PROPERTY_DEFINITION) int i; r = OPENSSL_malloc(sizeof(*r) - + (n == 0 ? 0 : n - 1) * sizeof(r->properties[0])); + + (n <= 0 ? 0 : n - 1) * sizeof(r->properties[0])); if (r != NULL) { sk_PROPERTY_DEFINITION_sort(sk); diff --git a/test/property_test.c b/test/property_test.c index 722de05..ee94252 100644 --- a/test/property_test.c +++ b/test/property_test.c @@ -304,10 +304,8 @@ static int test_property(void) for (i = 0; i < OSSL_NELEM(queries); i++) { OSSL_PROPERTY_LIST *pq = NULL; - if (!TEST_true(ossl_property_read_lock(store)) - || !TEST_true(ossl_method_store_fetch(store, queries[i].nid, - queries[i].prop, &result)) - || !TEST_true(ossl_property_unlock(store)) + if (!TEST_true(ossl_method_store_fetch(store, queries[i].nid, + queries[i].prop, &result)) || !TEST_str_eq((char *)result, queries[i].expected)) { TEST_note("iteration %zd", i + 1); ossl_property_free(pq);