summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2009-06-03 06:36:41 +0200
committerSimon Josefsson <simon@josefsson.org>2009-06-03 06:36:41 +0200
commit276f7b0cb8ecbd71a816d1e6f26e4561c4dc4d00 (patch)
treebc724ca2c06f37a86253bd46b6bce7ef11f76785
parent2e52f3fd0ea964e649dc59c6ddbcafddbe26aa1b (diff)
downloadgnutls-276f7b0cb8ecbd71a816d1e6f26e4561c4dc4d00.tar.gz
(_gnutls_x509_oid_data2string): Return proper @res_size for NULL res.
-rw-r--r--lib/x509/common.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/lib/x509/common.c b/lib/x509/common.c
index 2bcc66e5ef..51da7b1ac6 100644
--- a/lib/x509/common.c
+++ b/lib/x509/common.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation
*
* Author: Nikos Mavrogiannopoulos
*
@@ -291,25 +291,23 @@ _gnutls_x509_oid_data2string (const char *oid, void *value,
non_printable = 0;
}
- if (res)
+ if (non_printable == 0)
{
- if (non_printable == 0)
- {
- str[len] = 0;
- _gnutls_str_cpy (res, *res_size, str);
- *res_size = len;
- }
- else
+ str[len] = 0;
+
+ if (res)
+ _gnutls_str_cpy (res, *res_size, str);
+ *res_size = len;
+ }
+ else
+ {
+ result = _gnutls_x509_data2hex (str, len, res, res_size);
+ if (result < 0)
{
- result = _gnutls_x509_data2hex (str, len, res, res_size);
- if (result < 0)
- {
- gnutls_assert ();
- return result;
- }
+ gnutls_assert ();
+ return result;
}
}
-
}
return 0;