Welcome to little lamb

Code » anopa » commit 2659cdb

enable_service: Fix possibly reading oob memory

author Olivier Brunel
2016-09-16 20:47:41 UTC
committer Olivier Brunel
2016-09-16 20:47:41 UTC
parent c4e6b015ac1e453bd19f2eee8f81badcc49ba830

enable_service: Fix possibly reading oob memory

When looping over the different source dirs, we would try and read past
the final path, which could be outside our allocated memory area, and
even if not wasn't right.

src/libanopa/enable_service.c +2 -2

diff --git a/src/libanopa/enable_service.c b/src/libanopa/enable_service.c
index f8847ff..b062a74 100644
--- a/src/libanopa/enable_service.c
+++ b/src/libanopa/enable_service.c
@@ -2,7 +2,7 @@
  * anopa - Copyright (C) 2015-2016 Olivier Brunel
  *
  * enable_service.c
- * Copyright (C) 2015 Olivier Brunel <jjk@jjacky.com>
+ * Copyright (C) 2015-2016 Olivier Brunel <jjk@jjacky.com>
  *
  * This file is part of anopa.
  *
@@ -565,7 +565,7 @@ copy_from_source (const char        *name,
                     (name[len - 1] == '@') ? name + len : NULL);
 
         i += l_sce + 1;
-        if (i > aa_sa_sources.len)
+        if (i >= aa_sa_sources.len)
             return -ERR_UNKNOWN;
     }
 }