[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 26/29] device/net_io.c (net_getstat): check if addr_byte_count is
From: |
Marin Ramesa |
Subject: |
[PATCH 26/29] device/net_io.c (net_getstat): check if addr_byte_count is negative |
Date: |
Mon, 9 Dec 2013 23:57:41 +0100 |
Check if addr_byte_count is negative. If it is negative the call to
memcpy() will fail. In that case return KERN_INVALID_ARGUMENT.
* device/net_io.c (net_getstat): Check if addr_byte_count is negative.
---
device/net_io.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/device/net_io.c b/device/net_io.c
index b3ec292..f437340 100644
--- a/device/net_io.c
+++ b/device/net_io.c
@@ -1404,7 +1404,8 @@ net_getstat(ifp, flavor, status, count)
int addr_int_count;
int i;
- addr_byte_count = ifp->if_address_size;
+ if ((addr_byte_count = ifp->if_address_size) < 0)
+ return KERN_INVALID_ARGUMENT;
addr_int_count = (addr_byte_count + (sizeof(int)-1))
/ sizeof(int);
--
1.8.1.4
- [PATCH 18/29] device/dev_pager.c: remove forward declaration, (continued)
- [PATCH 18/29] device/dev_pager.c: remove forward declaration, Marin Ramesa, 2013/12/09
- [PATCH 19/29] device/dev_pager.c: remove forward declarations, Marin Ramesa, 2013/12/09
- [PATCH 20/29] device/ds_routines.c: remove forward declaration, Marin Ramesa, 2013/12/09
- [PATCH 21/29] device/ds_routines.c (device_write_get): check if io_count is larger or equal to zero and cast it to size_t, Marin Ramesa, 2013/12/09
- [PATCH 22/29] device/kmsg.c (kmsgread): check if io_count is larger or equal to zero and cast it to vm_size_t, Marin Ramesa, 2013/12/09
- [PATCH 23/29] device/kmsg.c (kmsgread, kmsg_read_done): cast arguments to memcpy(), Marin Ramesa, 2013/12/09
- [PATCH 24/29] device/kmsg.c (kmsg_read_done): check if amt is negative, Marin Ramesa, 2013/12/09
- [PATCH 25/29] device/net_io.c: remove forward declarations, Marin Ramesa, 2013/12/09
- [PATCH 26/29] device/net_io.c (net_getstat): check if addr_byte_count is negative,
Marin Ramesa <=
- [PATCH 27/29] device/net_io.c (net_getstat): cast arguments to memcpy(), Marin Ramesa, 2013/12/09
- [PATCH 28/29] device/net_io.c (net_getstat): cast arguments to memset(), Marin Ramesa, 2013/12/09
- [PATCH 29/29] device/subrs.c: use io_req_t instead of struct buf, Marin Ramesa, 2013/12/09