[Tinyos-devel] patch to reject big serial sends

Chieh-Jan (Mike) Liang cliang4 at cs.jhu.edu
Thu Feb 12 17:00:03 PST 2009


CC2420 stack also has this check, and I believe it returns ESIZE,  
instead of FAIL. Maybe we should keep things consistent?

Mike

On Feb 12, 2009, at 6: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;
> +    }
> +
>      header->dest = dest;
>      // Do not set the source address or group, as doing so
>      // prevents transparent bridging. Need a better long-term
> _______________________________________________
> Tinyos-devel mailing list
> Tinyos-devel at millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-devel



More information about the Tinyos-devel mailing list