The current X.25 code attempts to decode fields in X.25 packets that are not present. Here is a little patch that checks the received packet length before attempting to decode the missing fields. It also improves error checking for malformed packets.