summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbeck <>2023-05-03 07:13:18 +0000
committerbeck <>2023-05-03 07:13:18 +0000
commitcea0b430f541b07759c7530928f4ead668c75704 (patch)
tree44a466f0d1c5f3994f465628cd834595e9618ff1
parentbf0ee3122df40f6cd037a680c6c6b92dc6f31e56 (diff)
downloadopenbsd-cea0b430f541b07759c7530928f4ead668c75704.tar.gz
openbsd-cea0b430f541b07759c7530928f4ead668c75704.tar.bz2
openbsd-cea0b430f541b07759c7530928f4ead668c75704.zip
Bring back length check tb ok'ed and I managed to remove while
changing tests. ok tb@
-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';