about summary refs log tree commit diff
path: root/sunrpc/clnt_tcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'sunrpc/clnt_tcp.c')
-rw-r--r--sunrpc/clnt_tcp.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/sunrpc/clnt_tcp.c b/sunrpc/clnt_tcp.c
index 7cfbe9e8dd..d1fc43dbfd 100644
--- a/sunrpc/clnt_tcp.c
+++ b/sunrpc/clnt_tcp.c
@@ -364,6 +364,8 @@ static bool_t
 clnttcp_control (CLIENT *cl, int request, char *info)
 {
   struct ct_data *ct = (struct ct_data *) cl->cl_private;
+  u_long *mcall_ptr;
+  u_long ul;
 
 
   switch (request)
@@ -393,11 +395,24 @@ clnttcp_control (CLIENT *cl, int request, char *info)
        * first element in the call structure *.
        * This will get the xid of the PREVIOUS call
        */
+#if 0
+      /* This original code has aliasing issues.  */
       *(u_long *)info = ntohl (*(u_long *)ct->ct_mcall);
+#else
+      mcall_ptr = (u_long *)ct->ct_mcall;
+      ul = ntohl (*mcall_ptr);
+      memcpy (info, &ul, sizeof (ul));
+#endif
       break;
     case CLSET_XID:
       /* This will set the xid of the NEXT call */
+#if 0
+      /* This original code has aliasing issues.  */
       *(u_long *)ct->ct_mcall =  htonl (*(u_long *)info - 1);
+#else
+      ul = ntohl (*(u_long *)info - 1);
+      memcpy (ct->ct_mcall, &ul, sizeof (ul));
+#endif
       /* decrement by 1 as clnttcp_call() increments once */
       break;
     case CLGET_VERS: