]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Corrected bug in gnutls_pcert_list_import_x509_raw().
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Sat, 15 Feb 2014 09:06:21 +0000 (10:06 +0100)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Sat, 15 Feb 2014 09:06:21 +0000 (10:06 +0100)
The bug caused gnutls_pcert_list_import_x509_raw() to crash if
gnutls_x509_crt_list_import() would fail with the provided data.
Reported by Dmitriy Anisimkov.

lib/gnutls_pcert.c

index 56c2d6fe2ef893e85de73ff3cc832e4c5fc86f95..344b3e9df676da616c08fd6286cb533bb99db156 100644 (file)
@@ -124,7 +124,7 @@ gnutls_pcert_list_import_x509_raw(gnutls_pcert_st * pcerts,
                                        flags);
        if (ret < 0) {
                ret = gnutls_assert_val(ret);
-               goto cleanup;
+               goto cleanup_crt;
        }
 
        for (i = 0; i < *pcert_max; i++) {
@@ -138,14 +138,15 @@ gnutls_pcert_list_import_x509_raw(gnutls_pcert_st * pcerts,
        ret = 0;
        goto cleanup;
 
     cleanup_pcert:
+ cleanup_pcert:
        for (j = 0; j < i; j++)
                gnutls_pcert_deinit(&pcerts[j]);
 
     cleanup:
+ cleanup:
        for (i = 0; i < *pcert_max; i++)
                gnutls_x509_crt_deinit(crt[i]);
-
+ cleanup_crt:
        gnutls_free(crt);
        return ret;