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

Sebastian Meiling notifications at github.com
Fri Sep 6 12:57:06 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))) {

I wonder if this can be simplified to `(pkt_pos >= hdr_end) || (*pkt_pos == 0xFF)` because `hdr_end = pkt->payload` and `0xFF` is the payload marker so if `pkt_pos == 0xFF` then `pkt_pos + 1` should be `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#pullrequestreview-284793898
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190906/7d4ca246/attachment.htm>


More information about the notifications mailing list