nuttx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #3889: net/dns:fix unaligned access in dns query
Date Thu, 10 Jun 2021 05:37:14 GMT

xiaoxiang781216 commented on a change in pull request #3889:
URL: https://github.com/apache/incubator-nuttx/pull/3889#discussion_r648863070



##########
File path: libs/libc/netdb/lib_dnsquery.c
##########
@@ -439,8 +440,11 @@ static int dns_recv_response(int sd, FAR union dns_addr_u *addr, int
naddr,
   ninfo("Question: type=%04x, class=%04x\n",
         ntohs(que->type), ntohs(que->class));
 
-  if (que->type  != qinfo->rectype ||
-      que->class != HTONS(DNS_CLASS_IN))
+  /* N.B. Unaligned access may occur here */
+
+  temp = HTONS(DNS_CLASS_IN);
+  if (memcmp(&que->type, &qinfo->rectype, sizeof(uint16_t)) != 0 ||

Review comment:
       Ok, but line 440-441 need be removed too.




-- 
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.

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



Mime
View raw message