[RTEMS Project] #2248: misaligned pointer dereference in clnt_udp.c line 363

RTEMS trac trac at rtems.org
Tue Feb 3 20:26:59 UTC 2015


#2248: misaligned pointer dereference in clnt_udp.c line 363
--------------------+------------------
 Reporter:  johill  |      Owner:
     Type:  defect  |     Status:  new
 Priority:  normal  |  Milestone:  4.11
Component:  cpukit  |    Version:  4.10
 Severity:  normal  |   Keywords:
--------------------+------------------
 We see a misaligned pointer address violation at clnt_udp.c 363. Perhaps
 no one is hosting udp sun rpc services on RTEMS recently?

 This patch fixes the previous revision on the following source file which
 was probably installed to fix a gcc aliasing warning.

 cpukit/librpc/src/rpc/clnt_udp.c

 @@ -89,13 +89,13 @@ struct cu_data {
         u_int              cu_xdrpos;
         u_int                   cu_sendsz;      /* send size */
         union {
 -         u_int32_t        *i32;
 +         u_int32_t        *pi32;
           char             *c;
         } _cu_outbuf;
  #define cu_outbuf _cu_outbuf.c
         u_int                   cu_recvsz;      /* recv size */
         union {
 -         u_int32_t     * i32;
 +         u_int32_t     i32;
           char          c[1];
         } _cu_inbuf;
  #define cu_inbuf _cu_inbuf.c
 @@ -360,7 +360,7 @@ send_again:
                 if (inlen < sizeof(u_int32_t))
                         continue;
                 /* see if reply transaction id matches sent id */
 -               if (*(cu->_cu_inbuf.i32) != *(cu->_cu_outbuf.i32))
 +               if ( cu->_cu_inbuf.i32 != *cu->_cu_outbuf.pi32 )
                         continue;
                 /* we now assume we have the proper reply */
                 break;

--
Ticket URL: <http://devel.rtems.org/ticket/2248>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list