summaryrefslogtreecommitdiff
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:16:08 +0200
commit5b1996aaa1fddcc7f049cae518a57b2544c99aaf (patch)
tree086687ccb0a7348e385029c99f3ff509fa24768c
parent5fc6ff2821e451abdd10bcf192c8734dd5d49211 (diff)
downloadgnutls-5b1996aaa1fddcc7f049cae518a57b2544c99aaf.tar.gz
When decoding of a DN string fails, treat it as unknown string and print its hex value.
-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 7a038341ba..506d26909d 100644
--- a/lib/x509/common.c
+++ b/lib/x509/common.c
@@ -434,6 +434,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)
@@ -453,14 +454,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);