summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/x509/x509name.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libcrypto/x509/x509name.c b/src/lib/libcrypto/x509/x509name.c
index 3c9e224c1b..319d79d74f 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.32 2023/05/02 14:13:05 beck Exp $ */ 1/* $OpenBSD: x509name.c,v 1.33 2023/05/03 07:13:18 beck 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 *
@@ -107,7 +107,7 @@ X509_NAME_get_text_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, char *buf,
107 goto err; 107 goto err;
108 /* We still support the "pass NULL to find out how much" API */ 108 /* We still support the "pass NULL to find out how much" API */
109 if (buf != NULL) { 109 if (buf != NULL) {
110 if (!CBS_write_bytes(&cbs, buf, len - 1, NULL)) 110 if (len <= 0 || !CBS_write_bytes(&cbs, buf, len - 1, NULL))
111 goto err; 111 goto err;
112 /* It must be a C string */ 112 /* It must be a C string */
113 buf[text_len] = '\0'; 113 buf[text_len] = '\0';