Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group AFNUM needs to be extracted before moving bp pointer #1025

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion print-pgm.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ pgm_print(netdissect_options *ndo,
case PGM_NCF: {
const struct pgm_nak *nak;
char source_buf[INET6_ADDRSTRLEN], group_buf[INET6_ADDRSTRLEN];
unsigned afnum;

nak = (const struct pgm_nak *)(pgm + 1);
ND_TCHECK_SIZE(nak);
Expand Down Expand Up @@ -358,8 +359,9 @@ pgm_print(netdissect_options *ndo,
* Skip past the group, saving info along the way
* and stopping if we don't have enough.
*/
afnum = GET_BE_U_2(bp);
bp += (2 * sizeof(uint16_t));
switch (GET_BE_U_2(bp)) {
switch (afnum) {
case AFNUM_INET:
ND_TCHECK_LEN(bp, sizeof(nd_ipv4));
addrtostr(bp, group_buf, sizeof(group_buf));
Expand Down