-allow for 0-termination

This commit is contained in:
Christian Grothoff
2013-09-09 07:28:33 +00:00
parent a25dc0d379
commit 78e5722f45
+3 -3
View File
@@ -393,9 +393,9 @@ setup_session (gnutls_session_t * session,
const char *err_pos;
gnutls_certificate_allocate_credentials (xcred);
key->size = strlen (srv_key_pem);
key->size = strlen (srv_key_pem) + 1;
key->data = malloc (key->size);
if (key->data == NULL)
if (NULL == key->data)
{
gnutls_certificate_free_credentials (*xcred);
return -1;
@@ -403,7 +403,7 @@ setup_session (gnutls_session_t * session,
memcpy (key->data, srv_key_pem, key->size);
cert->size = strlen (srv_self_signed_cert_pem) + 1;
cert->data = malloc (cert->size);
if (cert->data == NULL)
if (NULL == cert->data)
{
gnutls_certificate_free_credentials (*xcred);
free (key->data);