upstream: avoid strlen(NULL) crash if an X11 channel was created before

the x11-req SSH_MSG_CHANNEL_REQUEST was sent. Reported by Ben Perry via
GHPR679

OpenBSD-Commit-ID: 31db0da9ab6c73e6bbf4021ffd53dc3ce5c65f23
This commit is contained in:
djm@openbsd.org authored and Damien Miller committed 2026-05-31 16:15:17 +10:00
1 parent df18979e11
commit a1dd1c8068
1 file changed
+6 -1
+6 -1
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: channels.c,v 1.459 2026/04/20 07:43:52 job Exp $ */
/* $OpenBSD: channels.c,v 1.460 2026/05/31 06:14:42 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1376,6 +1376,11 @@ x11_open_helper(struct ssh *ssh, struct sshbuf *b)
u_char *ucp;
u_int proto_len, data_len;
if (sc->x11_saved_proto == NULL) {
error("X11 forwarding opened before X11 forwarding requested");
return -1;
}
/* Is this being called after the refusal deadline? */
if (sc->x11_refuse_time != 0 &&
monotime() >= sc->x11_refuse_time) {