From: Simon Josefsson Date: Wed, 3 Jun 2009 04:36:41 +0000 (+0200) Subject: (_gnutls_x509_oid_data2string): Return proper @res_size for NULL res. X-Git-Tag: gnutls_2_9_1~13 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=276f7b0cb8ecbd71a816d1e6f26e4561c4dc4d00;p=thirdparty%2Fgnutls.git (_gnutls_x509_oid_data2string): Return proper @res_size for NULL res. --- 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;