]> The Tcpdump Group git mirrors - tcpdump/commitdiff
pgm: don't advance bp by the option haeder length twice.
authorGuy Harris <[email protected]>
Tue, 22 Aug 2023 19:23:20 +0000 (12:23 -0700)
committerGuy Harris <[email protected]>
Tue, 22 Aug 2023 19:23:20 +0000 (12:23 -0700)
At those points, we've already advanced it by the option header length,
and opt_len includes that length, so advance bp by opt_len minus the
option header length.

Fixes #1024.

print-pgm.c

index d4536ce1f50e4b6adf3d8ffd3224564665cea8c4..c62fd03e202e42f954f44bc0ecf3d1af3a829ff5 100644 (file)
@@ -674,7 +674,7 @@ pgm_print(netdissect_options *ndo,
 
                case PGM_OPT_PATH_NLA:
                    ND_PRINT(" PATH_NLA [%u]", opt_len);
-                   bp += opt_len;
+                   bp += opt_len - 2;
                    opts_len -= opt_len;
                    break;
 
@@ -716,7 +716,7 @@ pgm_print(netdissect_options *ndo,
 
                case PGM_OPT_CR:
                    ND_PRINT(" CR");
-                   bp += opt_len;
+                   bp += opt_len - 2;
                    opts_len -= opt_len;
                    break;
 
@@ -820,7 +820,7 @@ pgm_print(netdissect_options *ndo,
 
                default:
                    ND_PRINT(" OPT_%02X [%u] ", opt_type, opt_len);
-                   bp += opt_len;
+                   bp += opt_len - 2;
                    opts_len -= opt_len;
                    break;
                }