X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=apps%2Ftests%2FTestSerialBandwidth%2FTestSerialC.nc;h=671210b3846bdcf395fd46e8eb632b01878dd71b;hb=da0cfeda9689aa64cfce0aa209f51803dcb11c21;hp=b361e3ab62066a75ef28e45dcab562ce7e4121f7;hpb=594acbf436f5f78611348f7763a89c84f38ba46a;p=tinyos-2.x.git diff --git a/apps/tests/TestSerialBandwidth/TestSerialC.nc b/apps/tests/TestSerialBandwidth/TestSerialC.nc index b361e3ab..671210b3 100644 --- a/apps/tests/TestSerialBandwidth/TestSerialC.nc +++ b/apps/tests/TestSerialBandwidth/TestSerialC.nc @@ -83,8 +83,8 @@ implementation { return; } else { - TestSerialMsg* rcm = (TestSerialMsg*)call Packet.getPayload(&packet, NULL); - if (call Packet.maxPayloadLength() < sizeof(TestSerialMsg)) { + TestSerialMsg* rcm = (TestSerialMsg*)call Packet.getPayload(&packet, sizeof(TestSerialMsg)); + if (rcm == NULL || call Packet.maxPayloadLength() < sizeof(TestSerialMsg)) { return; } @@ -128,7 +128,10 @@ implementation { locked = FALSE; // as fast as possible if (afap){ - TestSerialMsg* rcm = (TestSerialMsg*)call Packet.getPayload(&packet,NULL); + TestSerialMsg* rcm = (TestSerialMsg*)call Packet.getPayload(&packet, sizeof(TestSerialMsg)); + if (rcm == NULL || call Packet.payloadLength(&packet) != sizeof(TestSerialMsg)) { + return; + } counter++; rcm->counter = counter; call Leds.led0Toggle();