From: Denis Ovsienko Date: Thu, 14 Mar 2013 15:58:51 +0000 (+0400) Subject: fix two issues with PGM length handling X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/e89baf86a45acd36e8e86374546067a527f6b758 fix two issues with PGM length handling 1. "TSDU Length" comes in network byte order on wire, add missing macro. 2. The (unused) justification of the number of bytes on wire wasn't correct because one side of the comparison included header size and another didn't (note the byte order as well). Besides that, the value of TSDU Length was already output thus far. Don't justify the number of bytes on wire and change the final printf() to make a use of it. --- diff --git a/print-pgm.c b/print-pgm.c index a880ae5d..ac560ec9 100644 --- a/print-pgm.c +++ b/print-pgm.c @@ -237,14 +237,11 @@ pgm_print(register const u_char *bp, register u_int length, TCHECK(*pgm); - (void)printf("PGM, length %u", pgm->pgm_length); + (void)printf("PGM, length %u", EXTRACT_16BITS(&pgm->pgm_length)); if (!vflag) return; - if (length > pgm->pgm_length) - length = pgm->pgm_length; - (void)printf(" 0x%02x%02x%02x%02x%02x%02x ", pgm->pgm_gsid[0], pgm->pgm_gsid[1], @@ -836,7 +833,7 @@ pgm_print(register const u_char *bp, register u_int length, } } - (void)printf(" [%u]", EXTRACT_16BITS(&pgm->pgm_length)); + (void)printf(" [%u]", length); return;