]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Add additional checks to make sure we don't go past the end of the packet.
authorGuy Harris <[email protected]>
Sun, 21 Feb 2010 06:43:19 +0000 (22:43 -0800)
committerGuy Harris <[email protected]>
Sun, 21 Feb 2010 06:43:19 +0000 (22:43 -0800)
print-ntp.c

index 6fc1dd0dc0afe91306de3c6704039d50d98d251f..d56f02a2624f9482d43d401185f27e6b6be6f231 100644 (file)
@@ -183,9 +183,12 @@ ntp_print(register const u_char *cp, u_int length)
        p_ntp_delta(&(bp->org_timestamp), &(bp->xmt_timestamp));
 
        if ( (sizeof(struct ntpdata) - length) == 16) {         /* Optional: key-id */
+               TCHECK(bp->key_id);
                printf("\n\tKey id: %u", bp->key_id);
        } else if ( (sizeof(struct ntpdata) - length) == 0) {   /* Optional: key-id + authentication */
+               TCHECK(bp->key_id);
                printf("\n\tKey id: %u", bp->key_id);
+               TCHECK2(bp->message_digest, sizeof (bp->message_digest));
                 printf("\n\tAuthentication: %08x%08x%08x%08x",
                               EXTRACT_32BITS(bp->message_digest),
                               EXTRACT_32BITS(bp->message_digest + 4),