summaryrefslogtreecommitdiff
path: root/lib/x509/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/x509/common.c')
-rw-r--r--lib/x509/common.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/x509/common.c b/lib/x509/common.c
index c156bd96a9..94d206ff75 100644
--- a/lib/x509/common.c
+++ b/lib/x509/common.c
@@ -630,7 +630,8 @@ _gnutls_x509_decode_string(unsigned int etype,
if (td.data == NULL)
return gnutls_assert_val(GNUTLS_E_MEMORY_ERROR);
- memcpy(td.data, str, str_size);
+ if (str_size > 0)
+ memcpy(td.data, str, str_size);
td.data[str_size] = 0;
if (allow_ber)