Merge pull request #2840 from k-stachowiak/check-bounds-of-test-intex-in-suites

Add lower bound check to function index lookup
diff --git a/tests/suites/host_test.function b/tests/suites/host_test.function
index b6490fb..9dde6c2 100644
--- a/tests/suites/host_test.function
+++ b/tests/suites/host_test.function
@@ -504,7 +504,7 @@
     const char **test_files = NULL;
     size_t testfile_count = 0;
     int option_verbose = 0;
-    int function_id = 0;
+    size_t function_id = 0;
 
     /* Other Local variables */
     int arg_index = 1;
@@ -695,7 +695,7 @@
                 }
 #endif /* __unix__ || __APPLE__ __MACH__ */
 
-                function_id = strtol( params[0], NULL, 10 );
+                function_id = strtoul( params[0], NULL, 10 );
                 if ( (ret = check_test( function_id )) == DISPATCH_TEST_SUCCESS )
                 {
                     ret = convert_params( cnt - 1, params + 1, int_params );
diff --git a/tests/suites/main_test.function b/tests/suites/main_test.function
index a1ba610..5986758 100644
--- a/tests/suites/main_test.function
+++ b/tests/suites/main_test.function
@@ -186,7 +186,7 @@
  *               DISPATCH_TEST_FN_NOT_FOUND if not found
  *               DISPATCH_UNSUPPORTED_SUITE if not compile time enabled.
  */
-int dispatch_test( int func_idx, void ** params )
+int dispatch_test( size_t func_idx, void ** params )
 {
     int ret = DISPATCH_TEST_SUCCESS;
     TestWrapper_t fp = NULL;
@@ -217,7 +217,7 @@
  *               DISPATCH_TEST_FN_NOT_FOUND if not found
  *               DISPATCH_UNSUPPORTED_SUITE if not compile time enabled.
  */
-int check_test( int func_idx )
+int check_test( size_t func_idx )
 {
     int ret = DISPATCH_TEST_SUCCESS;
     TestWrapper_t fp = NULL;