From 42b450d2e6d5eda17245d38f4d2bceb6b60e5400 Mon Sep 17 00:00:00 2001 From: rincon Date: Mon, 18 Aug 2008 22:04:15 +0000 Subject: [PATCH] Added a length check to make sure we don't try to send a packet that is too big --- tos/chips/cc2420/CC2420ActiveMessageP.nc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tos/chips/cc2420/CC2420ActiveMessageP.nc b/tos/chips/cc2420/CC2420ActiveMessageP.nc index be409637..0db2423c 100644 --- a/tos/chips/cc2420/CC2420ActiveMessageP.nc +++ b/tos/chips/cc2420/CC2420ActiveMessageP.nc @@ -62,6 +62,11 @@ implementation { message_t* msg, uint8_t len) { cc2420_header_t* header = call CC2420PacketBody.getHeader( msg ); + + if (len > call Packet.maxPayloadLength()) { + return ESIZE; + } + header->type = id; header->dest = addr; header->destpan = call CC2420Config.getPanAddr(); -- 2.39.2