[riot-notifications] [RIOT-OS/RIOT] net/gnrc_lorawan: fix random_uint32_range upper bound (#16664)

José Alamos notifications at github.com
Mon Aug 2 09:41:06 CEST 2021

@jia200x commented on this pull request.

> @@ -100,7 +100,7 @@ uint32_t gnrc_lorawan_pick_channel(gnrc_lorawan_t *mac)
     uint8_t index = 0;
-    uint8_t random_number = random_uint32_range(0, bitarithm_bits_set(mac->channel_mask));
+    uint8_t random_number = random_uint32_range(0, bitarithm_bits_set(mac->channel_mask) + 1);

True. The for loop should be adapted to pick the first available channel instead.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210802/d28da5cb/attachment.htm>

More information about the notifications mailing list