Merge pull request #277 from simonduq/contrib/nullnet-examples-fix
NullNet examples: check paylaod size before reading it
This commit is contained in:
commit
c89d40590b
@ -65,9 +65,11 @@ AUTOSTART_PROCESSES(&nullnet_example_process);
|
||||
void input_callback(const void *data, uint16_t len,
|
||||
const linkaddr_t *src, const linkaddr_t *dest)
|
||||
{
|
||||
LOG_INFO("Received %u from ", *(unsigned *)data);
|
||||
LOG_INFO_LLADDR(src);
|
||||
LOG_INFO_("\n");
|
||||
if(len == sizeof(unsigned)) {
|
||||
LOG_INFO("Received %u from ", *(unsigned *)data);
|
||||
LOG_INFO_LLADDR(src);
|
||||
LOG_INFO_("\n");
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(nullnet_example_process, ev, data)
|
||||
|
@ -67,9 +67,11 @@ AUTOSTART_PROCESSES(&nullnet_example_process);
|
||||
void input_callback(const void *data, uint16_t len,
|
||||
const linkaddr_t *src, const linkaddr_t *dest)
|
||||
{
|
||||
LOG_INFO("Received %u from ", *(unsigned *)data);
|
||||
LOG_INFO_LLADDR(src);
|
||||
LOG_INFO_("\n");
|
||||
if(len == sizeof(unsigned)) {
|
||||
LOG_INFO("Received %u from ", *(unsigned *)data);
|
||||
LOG_INFO_LLADDR(src);
|
||||
LOG_INFO_("\n");
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(nullnet_example_process, ev, data)
|
||||
|
Loading…
Reference in New Issue
Block a user