summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2018-01-10 10:56:28 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2018-01-10 10:56:31 +0100
commit54366b41415ea1b8b76328954d9868e76019f7b3 (patch)
tree891833dabff4295e455a351822668fe07f79922e
parent4a3ed368aead6f0fafe667beb5fa65cb607a1cd1 (diff)
downloadgnutls-54366b41415ea1b8b76328954d9868e76019f7b3.tar.gz
gnutls_x509_crt_list_import: eliminated memory leak
That leak would be triggered if GNUTLS_X509_CRT_LIST_IMPORT_FAIL_IF_EXCEED flag was used and the input data would exceed the maximum limit. Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r--lib/x509/crl.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/x509/crl.c b/lib/x509/crl.c
index dfeea3939d..d8ae619c0c 100644
--- a/lib/x509/crl.c
+++ b/lib/x509/crl.c
@@ -1376,10 +1376,13 @@ gnutls_x509_crl_list_import(gnutls_x509_crl_t * crls,
if (count >= *crl_max) {
if (!
(flags &
- GNUTLS_X509_CRT_LIST_IMPORT_FAIL_IF_EXCEED))
+ GNUTLS_X509_CRT_LIST_IMPORT_FAIL_IF_EXCEED)) {
break;
- else
+ } else if (nocopy == 0) {
+ for (j = 0; j < count; j++)
+ gnutls_x509_crl_deinit(crls[j]);
nocopy = 1;
+ }
}
if (!nocopy) {
@@ -1392,7 +1395,6 @@ gnutls_x509_crl_list_import(gnutls_x509_crl_t * crls,
tmp.data = (void *) ptr;
tmp.size =
data->size - (ptr - (char *) data->data);
-
ret =
gnutls_x509_crl_import(crls[count], &tmp,
GNUTLS_X509_FMT_PEM);