From: Jan Mojzis <jan.mojzis@gmail.com>
Date: Sat, 19 Mar 2022 08:36:48 +0100
Origin: https://github.com/janmojzis/tinyssh/commit/0613ae9ef2fbac88522c8312456fb64d14020597
Subject: Workaround for incoming packets that doesn't honor
      the max. packet length

Index: tinyssh-20190101/tinyssh/packet_channel_open.c
===================================================================
--- tinyssh-20190101.orig/tinyssh/packet_channel_open.c
+++ tinyssh-20190101/tinyssh/packet_channel_open.c
@@ -49,7 +49,12 @@ int packet_channel_open(struct buf *b1,
             buf_putnum32(b2, id);                                   /* uint32    recipient channel */
             buf_putnum32(b2, id);                                   /* uint32    sender channel */
             buf_putnum32(b2, localwindow);                          /* uint32    initial window size */
-            buf_putnum32(b2, PACKET_LIMIT);                         /* uint32    maximum packet size */
+            /*
+            XXX
+            use PACKET_LIMIT/2 as maximum packet size,
+            workaround for miscalculated packet_length
+            */
+            buf_putnum32(b2, PACKET_LIMIT / 2);                     /* uint32    maximum packet size */
             packet_put(b2);
             buf_purge(b2);
             return 1;
