- if (*p == LLC_XID_FI) {
- ND_PRINT((ndo, ": %02x %02x", p[1], p[2]));
+ if (length == 0) {
+ /*
+ * XID with no payload.
+ * This could, for example, be an SNA
+ * "short form" XID.
+ */
+ return (hdrlen);
+ }
+ if (caplen < 1) {
+ nd_print_trunc(ndo);
+ if (caplen > 0)
+ ND_DEFAULTPRINT((const u_char *)p, caplen);
+ return (hdrlen);
+ }
+ if (EXTRACT_U_1(p) == LLC_XID_FI) {
+ if (caplen < 3 || length < 3) {
+ nd_print_trunc(ndo);
+ if (caplen > 0)
+ ND_DEFAULTPRINT((const u_char *)p, caplen);
+ } else
+ ND_PRINT(": %02x %02x",
+ EXTRACT_U_1(p + 1),
+ EXTRACT_U_1(p + 2));