[riot-notifications] [RIOT-OS/RIOT] net/netif: add function to get interface by name from a buffer (#16709)

Martine Lenders notifications at github.com
Wed Aug 4 17:02:55 CEST 2021


@miri64 commented on this pull request.



>      list_node_t *node = netif_list.next;
 
     char tmp[CONFIG_NETIF_NAMELENMAX];
 
     while (node) {
        netif_get_name((netif_t *)node, tmp);
-       if (strncmp(name, tmp, CONFIG_NETIF_NAMELENMAX) == 0) {
+       size_t len = strlen(tmp);
+       if (len == name_len && strncmp(name, tmp, name_len) == 0) {

Can't stop being pedantic :stuck_out_tongue_winking_eye: 
```suggestion
       if ((len == name_len) && (strncmp(name, tmp, name_len) == 0)) {
```

-- 
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/16709#pullrequestreview-722399481
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210804/ff271ba8/attachment.htm>


More information about the notifications mailing list