]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/lib/net/Deluge/DelugeManagerP.nc
Check the image number against the DELUGE_NUM_VOLUMES. The bug was reported by David...
[tinyos-2.x.git] / tos / lib / net / Deluge / DelugeManagerP.nc
index 3b97e9e595e42b21e31503ed2b3b1212892927a9..342d8ca21cfc6462209e83d9fa38aa2ec255282d 100644 (file)
@@ -90,14 +90,19 @@ implementation
       break;
     case DELUGE_CMD_ONLY_DISSEMINATE:
     case DELUGE_CMD_DISSEMINATE_AND_REPROGRAM:
-      if (call Resource.isOwner() || 
-         call Resource.immediateRequest() == SUCCESS) {
+      if (request->imgNum < DELUGE_NUM_VOLUMES &&
+         (call Resource.isOwner() || 
+          call Resource.immediateRequest() == SUCCESS)) {
        call DelugeMetadata.read(imgNum2volumeId[request->imgNum]);
       } else {
        sendReply(FAIL);
       }
       break;
     case DELUGE_CMD_REPROGRAM:
+      if (!(request->imgNum < DELUGE_NUM_VOLUMES)) {
+       sendReply(FAIL);
+       break;
+      }
     case DELUGE_CMD_REBOOT:
       delugeCmd.imgNum = imgNum2volumeId[request->imgNum];
       call DelayTimer.startOneShot(1024);