summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-01-06 00:44:11 -0800
committerGuy Harris <guy@alum.mit.edu>2015-01-06 11:06:43 -0800
commitbc619816f47834be0f699a05b4ce8048e027238b (patch)
treeaca1459bc1a692ab94d6f01029bb425f94e9ae10
parent3a681978eccec6b4a6373727e0af6480c0cc504f (diff)
downloadtcpdump_4.2.tar.gz
Check not just the capture length but the on-the-network length.tcpdump_4.2
-rw-r--r--print-arcnet.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/print-arcnet.c b/print-arcnet.c
index 9531f346..791a0a35 100644
--- a/print-arcnet.c
+++ b/print-arcnet.c
@@ -118,9 +118,8 @@ arcnet_if_print(const struct pcap_pkthdr *h, const u_char *p)
u_int seqid = 0;
u_char arc_type;
- if (caplen < ARC_HDRLEN) {
+ if (caplen < ARC_HDRLEN || length < ARC_HDRLEN) {
printf("[|arcnet]");
- return (caplen);
}
ap = (const struct arc_header *)p;
@@ -139,14 +138,14 @@ arcnet_if_print(const struct pcap_pkthdr *h, const u_char *p)
}
if (phds) {
- if (caplen < ARC_HDRNEWLEN) {
+ if (caplen < ARC_HDRNEWLEN || length < ARC_HDRNEWLEN) {
arcnet_print(p, length, 0, 0, 0);
printf("[|phds]");
return (caplen);
}
if (ap->arc_flag == 0xff) {
- if (caplen < ARC_HDRNEWLEN_EXC) {
+ if (caplen < ARC_HDRNEWLEN_EXC || length < ARC_HDRNEWLEN_EXC) {
arcnet_print(p, length, 0, 0, 0);
printf("[|phds extended]");
return (caplen);
@@ -205,7 +204,7 @@ arcnet_linux_if_print(const struct pcap_pkthdr *h, const u_char *p)
int archdrlen = 0;
u_char arc_type;
- if (caplen < ARC_LINUX_HDRLEN) {
+ if (caplen < ARC_LINUX_HDRLEN || length < ARC_LINUX_HDRLEN) {
printf("[|arcnet]");
return (caplen);
}
@@ -216,7 +215,7 @@ arcnet_linux_if_print(const struct pcap_pkthdr *h, const u_char *p)
switch (arc_type) {
default:
archdrlen = ARC_LINUX_HDRNEWLEN;
- if (caplen < ARC_LINUX_HDRNEWLEN) {
+ if (caplen < ARC_LINUX_HDRNEWLEN || length < ARC_LINUX_HDRNEWLEN) {
printf("[|arcnet]");
return (caplen);
}