summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libcrypto/x509/x509name.c8
-rw-r--r--src/lib/libssl/src/crypto/x509/x509name.c8
2 files changed, 10 insertions, 6 deletions
diff --git a/src/lib/libcrypto/x509/x509name.c b/src/lib/libcrypto/x509/x509name.c
index 465a1cadb5..14634013cf 100644
--- a/src/lib/libcrypto/x509/x509name.c
+++ b/src/lib/libcrypto/x509/x509name.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509name.c,v 1.12 2014/07/11 08:44:49 jsing Exp $ */ 1/* $OpenBSD: x509name.c,v 1.13 2014/09/29 04:17:24 miod Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -91,8 +91,10 @@ X509_NAME_get_text_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, char *buf,
91 i = (data->length > (len - 1)) ? (len - 1) : data->length; 91 i = (data->length > (len - 1)) ? (len - 1) : data->length;
92 if (buf == NULL) 92 if (buf == NULL)
93 return (data->length); 93 return (data->length);
94 memcpy(buf, data->data, i); 94 if (i >= 0) {
95 buf[i] = '\0'; 95 memcpy(buf, data->data, i);
96 buf[i] = '\0';
97 }
96 return (i); 98 return (i);
97} 99}
98 100
diff --git a/src/lib/libssl/src/crypto/x509/x509name.c b/src/lib/libssl/src/crypto/x509/x509name.c
index 465a1cadb5..14634013cf 100644
--- a/src/lib/libssl/src/crypto/x509/x509name.c
+++ b/src/lib/libssl/src/crypto/x509/x509name.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509name.c,v 1.12 2014/07/11 08:44:49 jsing Exp $ */ 1/* $OpenBSD: x509name.c,v 1.13 2014/09/29 04:17:24 miod Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -91,8 +91,10 @@ X509_NAME_get_text_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, char *buf,
91 i = (data->length > (len - 1)) ? (len - 1) : data->length; 91 i = (data->length > (len - 1)) ? (len - 1) : data->length;
92 if (buf == NULL) 92 if (buf == NULL)
93 return (data->length); 93 return (data->length);
94 memcpy(buf, data->data, i); 94 if (i >= 0) {
95 buf[i] = '\0'; 95 memcpy(buf, data->data, i);
96 buf[i] = '\0';
97 }
96 return (i); 98 return (i);
97} 99}
98 100