summaryrefslogtreecommitdiff
path: root/lib/x509/common.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2014-06-06 10:13:19 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2014-06-06 10:13:19 +0200
commit3f0321a5ff77a397361a1c793f999e8e990bf9ca (patch)
tree9ab9a1cfb9e335bd2de7996169ed48a9b2b3b577 /lib/x509/common.c
parent6f4ba87d301a9b017418a7fc726a06fe2081f392 (diff)
downloadgnutls-3f0321a5ff77a397361a1c793f999e8e990bf9ca.tar.gz
When decoding of a DN string fails, treat it as unknown string and print its hex value.
Diffstat (limited to 'lib/x509/common.c')
-rw-r--r--lib/x509/common.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/x509/common.c b/lib/x509/common.c
index c0d0f3e2ff..f31f0cfdd7 100644
--- a/lib/x509/common.c
+++ b/lib/x509/common.c
@@ -458,6 +458,7 @@ _gnutls_x509_dn_to_string(const char *oid, void *value,
oentry = get_oid_entry(oid);
if (oentry == NULL) { /* unknown OID -> hex */
+ unknown_oid:
str->size = value_size * 2 + 2;
str->data = gnutls_malloc(str->size);
if (str->data == NULL)
@@ -477,14 +478,18 @@ _gnutls_x509_dn_to_string(const char *oid, void *value,
if (oentry->asn_desc != NULL) { /* complex */
ret =
decode_complex_string(oentry, value, value_size, &tmp);
- if (ret < 0)
- return gnutls_assert_val(ret);
+ if (ret < 0) {
+ /* we failed decoding -> handle it as unknown OID */
+ goto unknown_oid;
+ }
} else {
ret =
_gnutls_x509_decode_string(oentry->etype, value,
value_size, &tmp);
- if (ret < 0)
- return gnutls_assert_val(ret);
+ if (ret < 0) {
+ /* we failed decoding -> handle it as unknown OID */
+ goto unknown_oid;
+ }
}
ret = str_escape(&tmp, str);