summaryrefslogtreecommitdiff
path: root/print-hncp.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2019-11-10 20:51:48 -0800
committerGuy Harris <guy@alum.mit.edu>2019-11-10 20:51:48 -0800
commit866358cc52760b68947ae57b4f75f1e1709700b6 (patch)
tree7e401d7491ab692deb1552add91c66cd8be17891 /print-hncp.c
parentc376b499aed0b943a3ffe796889676c10ab3aaed (diff)
downloadtcpdump-866358cc52760b68947ae57b4f75f1e1709700b6.tar.gz
Clean up rounding up.
Have roundup2() cast the power-of-2 argument to u_int; that way, you don't have to explicitly define it as an unsigned value in order to avoid compiler or UBSan complaints about signed integers. Use it instead of rolling our own rounding-to-a-power-of-2.
Diffstat (limited to 'print-hncp.c')
-rw-r--r--print-hncp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/print-hncp.c b/print-hncp.c
index 0593b65b..06c8c1a5 100644
--- a/print-hncp.c
+++ b/print-hncp.c
@@ -827,7 +827,7 @@ hncp_print_rec(netdissect_options *ndo,
nd_print_invalid(ndo);
}
l += 17;
- l += -l & 3;
+ l = roundup2(l, 4);
if (bodylen >= l)
hncp_print_rec(ndo, value + l, bodylen - l, indent+1);
}
@@ -852,7 +852,7 @@ hncp_print_rec(netdissect_options *ndo,
}
skip_multiline:
- i += 4 + bodylen + (-bodylen & 3);
+ i += 4 + roundup2(bodylen, 4);
}
print_type_in_line(ndo, last_type_mask, last_type_count, indent, &first_one);