Avoid infinite loop when printing garbled packets

This commit is contained in:
David Kopf 2011-10-27 11:13:26 -04:00
parent 899123a634
commit a547b2259e

View file

@ -492,12 +492,14 @@ compress_hdr_hc06(rimeaddr_t *rime_destaddr)
{ {
uint8_t tmp, iphc0, iphc1; uint8_t tmp, iphc0, iphc1;
#if DEBUG #if DEBUG
PRINTF("before compression: "); { uint16_t ndx;
for(tmp = 0; tmp < UIP_IP_BUF->len[1] + 40; tmp++) { PRINTF("before compression (%d): ", UIP_IP_BUF->len[1]);
uint8_t data = ((uint8_t *) (UIP_IP_BUF))[tmp]; for(ndx = 0; ndx < UIP_IP_BUF->len[1] + 40; ndx++) {
PRINTF("%02x", data); uint8_t data = ((uint8_t *) (UIP_IP_BUF))[ndx];
PRINTF("%02x", data);
}
PRINTF("\n");
} }
PRINTF("\n");
#endif #endif
hc06_ptr = rime_ptr + 2; hc06_ptr = rime_ptr + 2;
@ -1731,11 +1733,11 @@ input(void)
#if DEBUG #if DEBUG
{ {
uint8_t tmp; uint16_t ndx;
PRINTF("after decompression: "); PRINTF("after decompression %u:", SICSLOWPAN_IP_BUF->len[1]);
for (tmp = 0; tmp < SICSLOWPAN_IP_BUF->len[1] + 40; tmp++) { for (ndx = 0; ndx < SICSLOWPAN_IP_BUF->len[1] + 40; ndx++) {
uint8_t data = ((uint8_t *) (SICSLOWPAN_IP_BUF))[tmp]; uint8_t data = ((uint8_t *) (SICSLOWPAN_IP_BUF))[ndx];
PRINTF("%02x", data); PRINTF("%02x", data);
} }
PRINTF("\n"); PRINTF("\n");
} }