summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2026-05-09 14:16:37 +0000
committertb <>2026-05-09 14:16:37 +0000
commitc6489249a3c1cf02630823f8d56d7b0e1c77d25e (patch)
tree7bfb635154eb819567b53406cf4a4145d9d8986f /src
parenteb7b0089a32bfe0cc25aea8748f4b35f315d31a7 (diff)
downloadopenbsd-c6489249a3c1cf02630823f8d56d7b0e1c77d25e.tar.gz
openbsd-c6489249a3c1cf02630823f8d56d7b0e1c77d25e.tar.bz2
openbsd-c6489249a3c1cf02630823f8d56d7b0e1c77d25e.zip
openssl s_client: avoid two out of bounds writes
A NUL termination after an unchecked BIO_read() call in XMSS mode could lead to a write one byte before the start of sbuf or one past its end. Add an error check to avoid the former and read one byte less to avoid the latter. Found by Frank Denis
Diffstat (limited to 'src')
-rw-r--r--src/usr.bin/openssl/s_client.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/usr.bin/openssl/s_client.c b/src/usr.bin/openssl/s_client.c
index 2b05facc17..00b6f7178a 100644
--- a/src/usr.bin/openssl/s_client.c
+++ b/src/usr.bin/openssl/s_client.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s_client.c,v 1.68 2026/02/01 08:45:31 martijn Exp $ */ 1/* $OpenBSD: s_client.c,v 1.69 2026/05/09 14:16:37 tb 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 *
@@ -1314,7 +1314,9 @@ s_client_main(int argc, char **argv)
1314 } 1314 }
1315 BIO_printf(sbio, 1315 BIO_printf(sbio,
1316 "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>"); 1316 "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>");
1317 seen = BIO_read(sbio, sbuf, BUFSIZZ); 1317 seen = BIO_read(sbio, sbuf, BUFSIZZ - 1);
1318 if (seen <= 0)
1319 goto shut;
1318 sbuf[seen] = 0; 1320 sbuf[seen] = 0;
1319 if (!strstr(sbuf, "<proceed")) 1321 if (!strstr(sbuf, "<proceed"))
1320 goto shut; 1322 goto shut;