summaryrefslogtreecommitdiff
path: root/src/common.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2012-08-26 21:16:57 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2012-08-26 21:16:57 +0200
commit5a89c629932e80ad2332ab44b8c15786508d29f9 (patch)
tree951c48b6c20ec90ab7eb865dcedddb0603a0da01 /src/common.c
parent8bb82a3d386abc1c59cb16d3a6d8c68fb66a2170 (diff)
downloadgnutls-5a89c629932e80ad2332ab44b8c15786508d29f9.tar.gz
null terminate the certificate being print
Diffstat (limited to 'src/common.c')
-rw-r--r--src/common.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/common.c b/src/common.c
index 3928491fe2..1b881a8bb4 100644
--- a/src/common.c
+++ b/src/common.c
@@ -161,7 +161,7 @@ print_x509_info (gnutls_session_t session, int flag, int print_cert)
&size);
if (ret == GNUTLS_E_SHORT_MEMORY_BUFFER)
{
- p = malloc (size);
+ p = malloc (size+1);
if (!p)
{
fprintf (stderr, "gnutls_malloc\n");
@@ -179,6 +179,7 @@ print_x509_info (gnutls_session_t session, int flag, int print_cert)
return;
}
+ p[size] = 0;
fputs ("\n", stdout);
fputs (p, stdout);
fputs ("\n", stdout);