diff --git a/main.c b/main.c index 33affd7..2041005 100644 --- a/main.c +++ b/main.c @@ -493,15 +493,18 @@ static int decrypt_packet (struct crypto_ctx *ctx, uint8_t *packet, size_t size, static void dump_ip_header (uint8_t *data, size_t size) { - const char tbl[] = "0123456789ABCDEF"; - size_t hex_size = (size<20)?size:20; - char hex[(20<<1)+1]; + if (size<20) + return; - for (size_t i=0; i>4)]; - hex[(i<<1)+1] = tbl[0xF&data[i]]; + hex[(i<<1)+1] = tbl[0xF&(data[i])]; } - hex[20<<1] = 0; + + hex[40] = 0; fprintf(stderr, "DUMP(%zu): %s\n", size, hex); }