[lldb-dev] unaligned cast in TCPSocket::Connect

Ted Woodward via lldb-dev lldb-dev at lists.llvm.org
Thu Oct 13 10:52:25 PDT 2016


TCPSocket::Connect has this line:

            host_str = ::inet_ntoa (*(struct in_addr
*)*host_entry->h_addr_list);

 

host_entry->h_addr_list is a char**, while struct in_addr contains a
uint32_t. Casting like this (char * to uint_32t *) could cause a bus error
on systems that don't allow non-aligned loads. I think we need to memcpy the
data into a struct in_addr variable.

 

Anyone have any thoughts on this?

 

--

Qualcomm Innovation Center, Inc.

The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a
Linux Foundation Collaborative Project

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20161013/a70392e3/attachment.html>


More information about the lldb-dev mailing list