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

[libvirt] [PATCH 3/7] cgroup: fix impossible overrun in virCgroupAddTaskController



The size of the controllers array is VIR_CGROUP_CONTROLLER_LAST, however
we only call it with values less than VIR_CGROUP_CONTROLLER_LAST.
---
 src/util/cgroup.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/util/cgroup.c b/src/util/cgroup.c
index 9e78314..490f1de 100644
--- a/src/util/cgroup.c
+++ b/src/util/cgroup.c
@@ -814,7 +814,7 @@ int virCgroupAddTask(virCgroupPtr group, pid_t pid)
  */
 int virCgroupAddTaskController(virCgroupPtr group, pid_t pid, int controller)
 {
-    if (controller < 0 || controller > VIR_CGROUP_CONTROLLER_LAST)
+    if (controller < 0 || controller >= VIR_CGROUP_CONTROLLER_LAST)
         return -EINVAL;
 
     if (!group->controllers[controller].mountPoint)
-- 
1.7.8.6


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