]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - apps/Oscilloscope/OscilloscopeC.nc
don't let reading go past the end of the array in the (unlikely but we believe possib...
[tinyos-2.x.git] / apps / Oscilloscope / OscilloscopeC.nc
index a73dd60be019be29c7b718fefded35a4f22a9c0e..3003b594133ea8dccb2ca4be3825a3679703f82f 100644 (file)
@@ -16,7 +16,7 @@
 #include "Timer.h"
 #include "Oscilloscope.h"
 
-module OscilloscopeC
+module OscilloscopeC @safe()
 {
   uses {
     interface Boot;
@@ -136,6 +136,7 @@ implementation
        data = 0xffff;
        report_problem();
       }
-    local.readings[reading++] = data;
+    if (reading < NREADINGS) 
+      local.readings[reading++] = data;
   }
 }