Unverified Commit c89d4059 authored by George Oikonomou's avatar George Oikonomou Committed by GitHub
Browse files

Merge pull request #277 from simonduq/contrib/nullnet-examples-fix

NullNet examples: check paylaod size before reading it
parents 8bee5ce5 715a1467
......@@ -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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment