[openssh-commits] [openssh] 01/02: upstream: do not fatal() on certain malformed SOCKS5 requests

git+noreply at mindrot.org git+noreply at mindrot.org
Wed Oct 28 09:54:37 AEDT 2026


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit d0dbcc0cd8a656f062cc85f0594179569f02a059
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Tue Oct 27 22:51:00 2026 +0000

    upstream: do not fatal() on certain malformed SOCKS5 requests
    
    based on patch from Karl Mehltretter via bz4034
    
    OpenBSD-Commit-ID: 5f9d187da386ba347eb5d81e02b917d0c5cc8bed
---
 channels.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/channels.c b/channels.c
index 936ec3779..dc008efc3 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: channels.c,v 1.472 2026/10/15 05:50:32 djm Exp $ */
+/* $OpenBSD: channels.c,v 1.473 2026/10/27 22:51:00 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo at cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -1709,7 +1709,7 @@ channel_decode_socks5(Channel *c, struct sshbuf *input, struct sshbuf *output)
 	uint16_t dest_port;
 	char dest_addr[255+1], ntop[INET6_ADDRSTRLEN];
 	u_int af;
-	int r, success = -1;;
+	int r, success = -1;
 	struct sshbuf *b = NULL;
 
 	debug2("channel %d: decode socks5 %s", c->self,
@@ -1733,8 +1733,11 @@ channel_decode_socks5(Channel *c, struct sshbuf *input, struct sshbuf *output)
 		success = socks_decode_error(c, r, __func__, "version");
 		goto out;
 	}
-	if (socks_ver != 5) /* shouldn't happen */
-		fatal_fr(r, "channel %d: internal error: not socks5", c->self);
+	if (socks_ver != 5) {
+		error_f("channel %d: SOCKS5 request with bad version %d",
+		    c->self, socks_ver);
+		goto out;
+	}
 
 	/* Parse SOCKS5 request header */
 	debug2("channel %d: socks5 post auth", c->self);

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list