diff options
author | Daiki Ueno <ueno@gnu.org> | 2021-01-31 11:49:37 +0000 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2021-01-31 11:49:37 +0000 |
commit | 0295456d9e3149d4b55f013cd681df8b93093d09 (patch) | |
tree | 540da57ec0ba64c5e1e91b975fca1547c445848c | |
parent | 85cb9bec3c6a37ff362fe8dfbb7afd82c91ea322 (diff) | |
parent | 1371d9c9da7d1995793e7dab769f49cbff3873fe (diff) | |
download | gnutls-0295456d9e3149d4b55f013cd681df8b93093d09.tar.gz |
Merge branch 'check_cert_list_argument' into 'master'
Verify that cert_list_size > 0 and cert_list != NULL
See merge request gnutls/gnutls!1379
-rw-r--r-- | lib/cert-cred-x509.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/cert-cred-x509.c b/lib/cert-cred-x509.c index f8cd881c2b..1b44f3a634 100644 --- a/lib/cert-cred-x509.c +++ b/lib/cert-cred-x509.c @@ -744,6 +744,9 @@ gnutls_certificate_set_x509_key(gnutls_certificate_credentials_t res, gnutls_pcert_st *pcerts = NULL; gnutls_str_array_t names; + if (cert_list == NULL || cert_list_size < 1) + return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST); + _gnutls_str_array_init(&names); /* this should be first @@ -1143,8 +1146,12 @@ gnutls_certificate_set_x509_trust(gnutls_certificate_credentials_t res, int ca_list_size) { int ret, i, j; - gnutls_x509_crt_t *new_list = gnutls_malloc(ca_list_size * sizeof(gnutls_x509_crt_t)); + gnutls_x509_crt_t *new_list; + + if (ca_list == NULL || ca_list_size < 1) + return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST); + new_list = gnutls_malloc(ca_list_size * sizeof(gnutls_x509_crt_t)); if (!new_list) return GNUTLS_E_MEMORY_ERROR; |