summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/gnutls_x509.c7
-rw-r--r--lib/gnutls_x509.h2
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/gnutls_x509.c b/lib/gnutls_x509.c
index 6a34391f0a..3782cd9e10 100644
--- a/lib/gnutls_x509.c
+++ b/lib/gnutls_x509.c
@@ -127,12 +127,13 @@ static int _IREAD(node_asn * rasn, char *name3, int name3_size, char *rstr, char
}
/* this function will convert up to 3 digit
- * numbers to characters.
+ * numbers to characters. Use a character string of MAX_INT_DIGITS, in
+ * order to have enough space for it.
*/
-void _gnutls_int2str(int k, char *data)
+void _gnutls_int2str(unsigned int k, char *data)
{
if (k > 999)
- data[0] = 0;
+ sprintf(data, "%d", 999);
else
sprintf(data, "%d", k);
}
diff --git a/lib/gnutls_x509.h b/lib/gnutls_x509.h
index 22826d01c9..5e8bba52e8 100644
--- a/lib/gnutls_x509.h
+++ b/lib/gnutls_x509.h
@@ -2,7 +2,7 @@ int _gnutls_x509_cert_verify_peers(GNUTLS_STATE state);
int _gnutls_x509_cert2gnutls_cert(gnutls_cert * gCert, gnutls_datum derCert);
#define MAX_INT_DIGITS 4
-void _gnutls_int2str(int k, char *data);
+void _gnutls_int2str(unsigned int k, char *data);
int _gnutls_check_x509_key_usage( const gnutls_cert * cert, KXAlgorithm alg);
time_t gnutls_x509_extract_certificate_activation_time( const gnutls_datum*);