]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
don't let reading go past the end of the array in the (unlikely but we believe possib...
authorregehr <regehr>
Thu, 8 Apr 2010 04:21:22 +0000 (04:21 +0000)
committerregehr <regehr>
Thu, 8 Apr 2010 04:21:22 +0000 (04:21 +0000)
apps/MultihopOscilloscope/MultihopOscilloscopeC.nc
apps/MultihopOscilloscopeLqi/MultihopOscilloscopeC.nc
apps/Oscilloscope/OscilloscopeC.nc

index 5179b3500d46aa8a37c9c3ba2a40a0e1a22d8687..a7f39ca62041355d2ea9e79c1667babab6b34023 100644 (file)
@@ -265,7 +265,8 @@ implementation {
       data = 0xffff;
       report_problem();
     }
-    local.readings[reading++] = data;
+    if (reading < NREADINGS)
+      local.readings[reading++] = data;
   }
 
 
index 17edb6b78c6c8d50c5a27e19f47c04039981a63c..5235446299051e288da27fd38ae3aad6e2036d08 100644 (file)
@@ -267,7 +267,8 @@ implementation {
       data = 0xffff;
       report_problem();
     }
-    local.readings[reading++] = data;
+    if (reading < NREADINGS)
+      local.readings[reading++] = data;
   }
 
 
index c4e0a1c0dc90ab0949860478dc91095e0f93189b..3003b594133ea8dccb2ca4be3825a3679703f82f 100644 (file)
@@ -136,6 +136,7 @@ implementation
        data = 0xffff;
        report_problem();
       }
-    local.readings[reading++] = data;
+    if (reading < NREADINGS) 
+      local.readings[reading++] = data;
   }
 }