- ND_PRINT((ndo, "%04x, ", EXTRACT_16BITS(ptr))); ptr++; /* Disconnect Code */
- ND_PRINT((ndo, "%04x ", EXTRACT_16BITS(ptr))); ptr++; /* Control Protocol Number */
+ if (length < 5) {
+ ND_PRINT((ndo, "AVP too short"));
+ return;
+ }
+ /* Disconnect Code */
+ ND_PRINT((ndo, "%04x, ", EXTRACT_BE_U_2(dat)));
+ dat += 2;
+ length -= 2;
+ /* Control Protocol Number */
+ ND_PRINT((ndo, "%04x ", EXTRACT_BE_U_2(dat)));
+ dat += 2;
+ length -= 2;
+ /* Direction */