[Tinyos-devel] patch to reject big serial sends
Razvan Musaloiu-E.
razvanm at cs.jhu.edu
Thu Feb 12 15:41:59 PST 2009
Hi!
I just noticed that serial packets that are bigger than TOSH_DATA_LENGTH
are not properly filtered in the AMSend.send from SerialActiveMessageP.nc.
Below is a patch that corrects this by returning FAIL. Should we return
ESIZE instead of FAIL? The comments about this in TinyError.h is the
following:
ESIZE = 2, // Parameter passed in was too big.
--
Razvan ME
diff --git a/tos/lib/serial/SerialActiveMessageP.nc b/tos/lib/serial/SerialActiveMessageP.nc
index 0432ad2..7711d14 100644 (file)
--- a/tos/lib/serial/SerialActiveMessageP.nc
+++ b/tos/lib/serial/SerialActiveMessageP.nc
@@ -58,6 +58,11 @@ implementation {
message_t* msg,
uint8_t len) {
serial_header_t* header = getHeader(msg);
+
+ if (len > TOSH_DATA_LENGTH) {
+ return FAIL;
+ }
+
header->dest = dest;
// Do not set the source address or group, as doing so
// prevents transparent bridging. Need a better long-term
More information about the Tinyos-devel
mailing list