]> The Tcpdump Group git mirrors - tcpdump/commitdiff
fix two issues with PGM length handling
authorDenis Ovsienko <[email protected]>
Thu, 14 Mar 2013 15:58:51 +0000 (19:58 +0400)
committerGuy Harris <[email protected]>
Mon, 15 Apr 2013 00:11:16 +0000 (17:11 -0700)
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.

print-pgm.c

index a880ae5d1dd3a21be7686a3bac05dd6177ef027a..ac560ec990125e5eaa34a1b24423a81e85cdd15f 100644 (file)
@@ -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;