bug-hurd
[Top][All Lists]
Advanced

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

[PATCH 24/29] device/kmsg.c (kmsg_read_done): check if amt is negative


From: Marin Ramesa
Subject: [PATCH 24/29] device/kmsg.c (kmsg_read_done): check if amt is negative
Date: Mon, 9 Dec 2013 23:57:39 +0100

Check if amt is negative. If it is negative the call to memcpy() 
will fail. In that case return FALSE.

* device/kmsg.c (kmsg_read_done): Check if amt is negative.

---
 device/kmsg.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/device/kmsg.c b/device/kmsg.c
index f6a21da..25fa91a 100644
--- a/device/kmsg.c
+++ b/device/kmsg.c
@@ -169,7 +169,8 @@ kmsg_read_done (io_req_t ior)
   if (len < 0)
     len += KMSGBUFSIZE;
 
-  amt = ior->io_count;
+  if ((amt = ior->io_count) < 0)
+    return FALSE;
   if (amt > len)
     amt = len;
   
-- 
1.8.1.4




reply via email to

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