bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/5] fix copyoutmsg for 64-bit userspace


From: Luca Dariz
Subject: [PATCH 2/5] fix copyoutmsg for 64-bit userspace
Date: Wed, 19 Apr 2023 21:47:00 +0200

* x86_64/copy_user.c: use the correct user/kernel msg structure
---
 x86_64/copy_user.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/x86_64/copy_user.c b/x86_64/copy_user.c
index b5084996..f76e44c9 100644
--- a/x86_64/copy_user.c
+++ b/x86_64/copy_user.c
@@ -430,7 +430,7 @@ int copyoutmsg (const void *kernelbuf, void *userbuf, const 
size_t ksize)
   usaddr = (vm_offset_t)(umsg + 1);
   keaddr = ksaddr + ksize - sizeof(mach_msg_header_t);
 
-  if (ksize > sizeof(mach_msg_user_header_t))
+  if (ksize > sizeof(mach_msg_header_t))
     {
       while (ksaddr < keaddr)
         {
@@ -484,8 +484,7 @@ int copyoutmsg (const void *kernelbuf, void *userbuf, const 
size_t ksize)
 
   mach_msg_size_t usize;
   usize = sizeof(mach_msg_user_header_t) + usaddr - (vm_offset_t)(umsg + 1);
-  usize = usize;
-  if (copyout(&usize, &umsg->msgh_size, sizeof(kmsg->msgh_size)))
+  if (copyout(&usize, &umsg->msgh_size, sizeof(umsg->msgh_size)))
     return 1;
 
   return 0;
-- 
2.30.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]