changeset 990:e3614649b1f5

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)
author Fedor Brunner <fedor.brunner@azet.sk>
date Fri, 23 Jan 2015 22:21:06 +0800
parents 6c0fb5428aaa
children 4f65c867fc99
files packet.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/packet.c	Tue Jan 13 20:55:04 2015 +0800
+++ b/packet.c	Fri Jan 23 22:21:06 2015 +0800
@@ -283,14 +283,14 @@
 	}
 	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 @@
 	/* - 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);