Enforce *double* our packet-size-limit temporarily.

This commit is contained in:
Tony Garnock-Jones 2011-10-25 19:02:23 -04:00
parent f6611fa671
commit d5fefe5146
1 changed files with 8 additions and 0 deletions

View File

@ -229,6 +229,14 @@
(define (check-packet-length! actual-length limit block-size)
(when (> actual-length limit)
(log-warning (format "Packet of length ~v exceeded our limit of ~v"
actual-length
limit)))
(when (> actual-length (* 2 limit))
;; TODO: For some reason, OpenSSH seems to occasionally slightly
;; exceed the packet size limit! (For example, sending a packet of
;; length 65564 when I'm expecting a max of 65536.) So we actually
;; enforce twice our actual limit.
(disconnect-with-error 0 ;; TODO: better reason code?
"Packet of length ~v is longer than packet limit ~v"
actual-length