mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-11-23 18:14:29 +08:00
Make sure the packet isn't cut short before verifying the MD5 signature.
Indicate why we can't verify the MD5 signature.
This commit is contained in:
parent
0cd29d2917
commit
e195fc87a8
17
print-tcp.c
17
print-tcp.c
@ -747,10 +747,17 @@ tcp_verify_signature(const struct ip *ip, const struct tcphdr *tp,
|
||||
u_int8_t nxt;
|
||||
#endif
|
||||
|
||||
if (data + length > snapend) {
|
||||
printf("snaplen too short, ");
|
||||
return (CANT_CHECK_SIGNATURE);
|
||||
}
|
||||
|
||||
tp1 = *tp;
|
||||
|
||||
if (sigsecret == NULL)
|
||||
if (sigsecret == NULL) {
|
||||
printf("shared secret not supplied with -M, ");
|
||||
return (CANT_CHECK_SIGNATURE);
|
||||
}
|
||||
|
||||
MD5_Init(&ctx);
|
||||
/*
|
||||
@ -778,8 +785,14 @@ tcp_verify_signature(const struct ip *ip, const struct tcphdr *tp,
|
||||
nxt = IPPROTO_TCP;
|
||||
MD5_Update(&ctx, (char *)&nxt, sizeof(nxt));
|
||||
#endif
|
||||
} else
|
||||
} else {
|
||||
#ifdef INET6
|
||||
printf("IP version not 4 or 6, ");
|
||||
#else
|
||||
printf("IP version not 4, ");
|
||||
#endif
|
||||
return (CANT_CHECK_SIGNATURE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Step 2: Update MD5 hash with TCP header, excluding options.
|
||||
|
Loading…
Reference in New Issue
Block a user