[riot-notifications] [RIOT-OS/RIOT] net/nanocoap: iterate options (#12074)

Sebastian Meiling notifications at github.com
Fri Sep 6 12:57:46 CEST 2019


smlng commented on this pull request.



>   */
 static uint8_t *_parse_option(const coap_pkt_t *pkt,
                               uint8_t *pkt_pos, uint16_t *delta, int *opt_len)
 {
     uint8_t *hdr_end = pkt->payload;
 
-    if (pkt_pos == hdr_end) {
+    if ((pkt_pos >= hdr_end)
+            || (((pkt_pos + 1) == hdr_end) && (*pkt_pos == 0xFF))) {

and hence we don't need the extra check verifying `pkt_pos + 1 == hdr_end`

-- 
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/12074#discussion_r321682908
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190906/3c05127e/attachment.htm>


More information about the notifications mailing list