[riot-notifications] [RIOT-OS/RIOT] pkg/semtech_loramac: fix DEBUG message when payload is NULL (#11529)

Parks Projets notifications at github.com
Wed May 15 21:14:11 CEST 2019


### Contribution description

In function `_semtech_loramac_send` parameter `payload` can be `NULL` (that's the case when scheduling an immediate TX, [line 726][line-726]). As `DEBUG` macro uses `printf`, a `%s` parameter can't be `NULL` so we have to handle that case.


### Testing procedure

First enable debug messages in `semtech_loramac.c`.  
Then make uplinks until you get the debug message `[semtech-loramac] schedule immediate TX` which indicates that the end device must provide an uplink as soon as possible. As `payload` parameter is `NULL` and `DEBUG` macro uses `%s` an undefined behavior will happen (see image below).


### Issues/PRs references

None

![Undefined behavior](https://i.imgur.com/vwJAqtG.png)

[line-726]: https://github.com/RIOT-OS/RIOT/blob/master/pkg/semtech-loramac/contrib/semtech_loramac.c#L726
You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/11529

-- Commit Summary --

  * pkg/semtech_loramac: fix DEBUG message when payload is NULL

-- File Changes --

    M pkg/semtech-loramac/contrib/semtech_loramac.c (2)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/11529.patch
https://github.com/RIOT-OS/RIOT/pull/11529.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11529
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190515/4a9c2fd8/attachment.html>


More information about the notifications mailing list