You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/12/28 06:08:50 UTC

[GitHub] [incubator-nuttx] normanr commented on a change in pull request #4890: [SECURITY]net/udp/icmp: correct the unreadchable handling

normanr commented on a change in pull request #4890:
URL: https://github.com/apache/incubator-nuttx/pull/4890#discussion_r775740083



##########
File path: include/nuttx/net/icmp.h
##########
@@ -113,8 +133,16 @@ struct icmp_hdr_s
 
   /* ICMP_ECHO_REQUEST and ICMP_ECHO_REPLY data */
 
-  uint16_t id;               /* Used to match requests with replies */
-  uint16_t seqno;            /* "  " "" "   " "      " "  " "     " */
+  union
+    {
+      struct
+        {
+          uint16_t id;      /* Used to match requests with replies */
+          uint16_t seqno;   /* "  " "" "   " "      " "  " "     " */
+        };
+
+      uint32_t data;

Review comment:
       This causes unaligned stores, because icmp is not guaranteed to be aligned to 4-bytes. None of the other parts of the icmp or ip headers use `unit32_t` anywhere, (rather they use `uint16_t[2]`).




-- 
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-unsubscribe@nuttx.apache.org

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