summaryrefslogtreecommitdiff
path: root/print-pgm.c
diff options
context:
space:
mode:
authorDenis Ovsienko <infrastation@yandex.ru>2013-03-14 19:58:51 +0400
committerMichael Richardson <mcr@sandelman.ca>2013-04-14 18:20:26 -0400
commit267910ecc12a555c50b677b89b44d9e60773e1be (patch)
tree0fc7ea4f04ff1527fa5ff9fd90f44b57f72e46ee /print-pgm.c
parent5aed2384cba6126178251c92f5928dbadb3401f4 (diff)
downloadtcpdump-267910ecc12a555c50b677b89b44d9e60773e1be.tar.gz
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.
Diffstat (limited to 'print-pgm.c')
-rw-r--r--print-pgm.c7
1 files changed, 2 insertions, 5 deletions
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;