[Tinyos-devel] patch to reject big serial sends
Philip Levis
pal at cs.stanford.edu
Fri Feb 13 09:49:56 PST 2009
On Feb 12, 2009, at 3:41 PM, Razvan Musaloiu-E. wrote:
> 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;
> + }
> +
It should be
if (len > call Packet.maxPayloadLength()) {
return ESIZE;
}
I've committed the change.
Phil
More information about the Tinyos-devel
mailing list