diff options
author | Fedor Brunner <fedor.brunner@azet.sk> | 2015-01-23 22:21:06 +0800 |
---|---|---|
committer | Fedor Brunner <fedor.brunner@azet.sk> | 2015-01-23 22:21:06 +0800 |
commit | 7b2c42aa75488a0dc4c720a1f3cdabfeef76ec91 (patch) | |
tree | ee7d053dd85e1b453ede44c8435dd2e2d45009b1 | |
parent | 1ed8d3938e736f9282f8d1cc12ac18b6fb05d4e5 (diff) |
Integrity error (bad packet size %u) negative length
When corrupted packet is received negative length of packet is
displayed.
(re-apply of pull request #8)
-rw-r--r-- | packet.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -283,14 +283,14 @@ static int read_packet_init() { } len = buf_getint(ses.readbuf) + 4 + macsize; - TRACE2(("packet size is %d, block %d mac %d", len, blocksize, macsize)) + TRACE2(("packet size is %u, block %u mac %u", len, blocksize, macsize)) /* check packet length */ if ((len > RECV_MAX_PACKET_LEN) || (len < MIN_PACKET_LEN + macsize) || ((len - macsize) % blocksize != 0)) { - dropbear_exit("Integrity error (bad packet size %d)", len); + dropbear_exit("Integrity error (bad packet size %u)", len); } if (len > ses.readbuf->size) { @@ -342,7 +342,7 @@ void decrypt_packet() { /* - 4 - 1 is for LEN and PADLEN values */ len = ses.readbuf->len - padlen - 4 - 1 - macsize; if ((len > RECV_MAX_PAYLOAD_LEN+ZLIB_COMPRESS_EXPANSION) || (len < 1)) { - dropbear_exit("Bad packet size %d", len); + dropbear_exit("Bad packet size %u", len); } buf_setpos(ses.readbuf, PACKET_PAYLOAD_OFF); |