summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--host/usrp_e_utils/usrp-e-loopback.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/host/usrp_e_utils/usrp-e-loopback.c b/host/usrp_e_utils/usrp-e-loopback.c
index 78e2b5d16..0bd3d3100 100644
--- a/host/usrp_e_utils/usrp-e-loopback.c
+++ b/host/usrp_e_utils/usrp-e-loopback.c
@@ -38,11 +38,15 @@ static int calc_checksum(struct pkt *p)
i = 0;
sum = 0;
- for (i=0; i < p->len; i++)
- sum += p->data[i];
-
- sum += p->seq_num;
- sum += p->len;
+ if (p->len < 1016) {
+ for (i=0; i < p->len; i++)
+ sum += p->data[i];
+
+ sum += p->seq_num;
+ sum += p->len;
+ } else {
+ printf("Bad packet length = %d received.\n", p->len);
+ }
return sum;
}