]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Check return value from gnutls_x509_crt_get_key_usage.
authorSimon Josefsson <simon@josefsson.org>
Thu, 3 Dec 2009 14:06:19 +0000 (15:06 +0100)
committerSimon Josefsson <simon@josefsson.org>
Thu, 3 Dec 2009 14:06:19 +0000 (15:06 +0100)
lib/gnutls_cert.c

index 6e5dcef9ea96e1680ceb3154c6f9464a1c7b9373..a303a07314ce2d1ead3cd6a38eda29d51e4ba392 100644 (file)
@@ -874,7 +874,14 @@ _gnutls_x509_crt_to_gcert (gnutls_cert * gcert,
 
   if (flags & CERT_ONLY_EXTENSIONS || flags == 0)
     {
-      gnutls_x509_crt_get_key_usage (cert, &gcert->key_usage, NULL);
+      ret = gnutls_x509_crt_get_key_usage (cert, &gcert->key_usage, NULL);
+      if (ret == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE)
+       gcert->key_usage = 0;
+      else if (ret < 0)
+       {
+         gnutls_assert ();
+         return ret;
+       }
       gcert->version = gnutls_x509_crt_get_version (cert);
     }
   gcert->subject_pk_algorithm = gnutls_x509_crt_get_pk_algorithm (cert, NULL);