[riot-notifications] [RIOT-OS/RIOT] sock_util: add interface descriptor parsing to str2ep (#14068)

Martine Lenders notifications at github.com
Tue May 19 08:45:48 CEST 2020


@miri64 commented on this pull request.



> +int _parse_netif(sock_udp_ep_t *ep_out, char *netifstart)
+{
+    char *netifend;
+    size_t netiflen;
+    char netifbuf[NETIF_STR_LEN + 1];
+
+    for (netifend = netifstart; *netifend && *netifend != ']';
+         netifend++);
+    netiflen = netifend - netifstart;
+    if (!*netifend || (netiflen >= NETIF_STR_LEN) || (netiflen == 0)) {
+        /* no netif found, bail out */
+        return -EINVAL;
+    }
+    strncpy(netifbuf, netifstart, netiflen);
+    int netif = strtol(netifbuf, NULL, 10);
+    if ((netif > UINT16_MAX) || (netif < 0)) {

but the `netif` member of a `sock_udp_ep_t` is `uint16_t`...

-- 
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/14068#discussion_r427065724
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200518/0e8fd280/attachment.htm>


More information about the notifications mailing list