[RTEMS Project] #3772: missaligned pointer dereference in cpukit/libnetworking/libc/res_query.c:131

RTEMS trac trac at rtems.org
Wed Jul 31 19:32:12 UTC 2019


#3772: missaligned pointer dereference in
cpukit/libnetworking/libc/res_query.c:131
---------------------------------------+---------------------
 Reporter:  Jeffrey Hill               |       Owner:  (none)
     Type:  defect                     |      Status:  new
 Priority:  normal                     |   Milestone:
Component:  network/legacy             |     Version:  4.11
 Severity:  normal                     |  Resolution:
 Keywords:  missaligned libnetworking  |  Blocked By:
 Blocking:                             |
---------------------------------------+---------------------

Comment (by Gedare Bloom):

 Probably the 'buf' should be aligned to the structure alignment since it
 gets cast to HEADER struct. You can at least use CPU_STRUCTURE_ALIGNMENT
 macro, or else create a union, something like this might work

 {{{
 union {
   struct {
     HEADER header;
     u_char payload[RTEMS_ZERO_LENGTH_ARRAY];
   };
   u_char buffer[MAXPACKET];
 } x;
   u_char *buf = x.buffer;
 }}}

--
Ticket URL: <http://devel.rtems.org/ticket/3772#comment:7>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list