isl_arg.c: drop_argument: avoid out-of-bounds array accesses
authorSven Verdoolaege <skimo@kotnet.org>
Sat, 9 Mar 2013 20:19:13 +0000 (21:19 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Wed, 13 Mar 2013 08:00:30 +0000 (09:00 +0100)
Reported-by: Tobias Grosser <tobias@grosser.es>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_arg.c

index f2025ee..3e2188b 100644 (file)
--- a/isl_arg.c
+++ b/isl_arg.c
@@ -1117,7 +1117,7 @@ static void print_version_and_exit(struct isl_arg *decl)
 
 static int drop_argument(int argc, char **argv, int drop, int n)
 {
-       for (; drop < argc; ++drop)
+       for (; drop + n < argc; ++drop)
                argv[drop] = argv[drop + n];
 
        return argc - n;