pkarashchenko commented on code in PR #12994:
URL: https://github.com/apache/nuttx/pull/12994#discussion_r1722339029


##########
libs/libc/net/lib_addroute.c:
##########
@@ -47,24 +47,24 @@
  *   netmask  - Network mask defining the external network (required)
  *   router   - Router address that on our network that can forward to the
  *              external network.
+ *   len      - The address struct length.
  *
  * Returned Value:
  *   OK on success; -1 on failure with the errno variable set appropriately.
  *
  ****************************************************************************/
 
-int addroute(int sockfd, FAR struct sockaddr_storage *target,
-             FAR struct sockaddr_storage *netmask,
-             FAR struct sockaddr_storage *router)
+int addroute(int sockfd, FAR void *target, FAR void *netmask,
+             FAR void *router, socklen_t len)
 {
   struct rtentry entry;
 
   /* Set up the rtentry structure */
 
   memset(&entry, 0, sizeof(struct rtentry));
-  memcpy(&entry.rt_dst, target, sizeof(struct sockaddr_storage));
-  memcpy(&entry.rt_genmask, netmask, sizeof(struct sockaddr_storage));
-  memcpy(&entry.rt_gateway, router, sizeof(struct sockaddr_storage));
+  memcpy(&entry.rt_dst, target, len);
+  memcpy(&entry.rt_genmask, netmask, len);

Review Comment:
   Any check that `len` is lees or equal to holder size needed?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to