Fix out-of-bounds access to the array
authorThiago Macieira <thiago.macieira@intel.com>
Thu, 24 Sep 2015 01:09:22 +0000 (18:09 -0700)
committerUze Choi <uzchoi@samsung.com>
Wed, 30 Sep 2015 10:32:18 +0000 (10:32 +0000)
The array has TIMEOUTS elements, so timeout_list[TIMEOUTS] is one
element past the end.

Change-Id: I42e7ef1a481840699a8dffff1406c4b42d42fde1
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/3017
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
extlibs/timer/timer.c

index d86bdef..29c9ceb 100755 (executable)
@@ -327,7 +327,7 @@ time_t registerTimer(const time_t seconds, int *id,  void (*cb)())
 
 void unregisterTimer(int idx)
 {
-    if( 0 <= idx && idx <= TIMEOUTS)
+    if( 0 <= idx && idx < TIMEOUTS)
         timeout_list[idx].timeout_state = TIMEOUT_UNUSED;
 }