--- ./session/ssh2_msgcli.c.orig	2024-10-31 00:50:22.889958000 -0400
+++ ./session/ssh2_msgcli.c	2024-10-31 00:50:23.388837000 -0400
@@ -610,11 +610,6 @@
 	BOOLEAN waitforWindow = FALSE;
 	int length;
 
-	status = getServiceType( sessionInfoPtr, &serviceType );
-	if( cryptStatusError( status ) ) {
-		return( status );
-	}
-
 	origWriteChannelNo = sessionInfoPtr->sessionSSH->currWriteChannel;
 	status = currentChannelNo = readUint32( stream );
 
@@ -635,6 +630,11 @@
 				  "Invalid channel information in channel open "
 				  "confirmation for channel %lX", channelNo ) );
 		}
+	status = getServiceType( sessionInfoPtr, &serviceType );
+	if( cryptStatusError( status ) ) {
+		return( status );
+	}
+
 	status = sread( stream, buffer, UINT32_SIZE );
 	if( !cryptStatusError( status ) && \
 		!memcmp( buffer, "\x00\x00\x00\x00", UINT32_SIZE ) )
