Bug 1391556 - fix incorrect out of bound check. r?jwwang draft
authorJohn Lin <jolin@mozilla.com>
Tue, 22 Aug 2017 10:06:41 +0800
changeset 650245 fee0090596a42d411a82ab1929bc4627e8eeca74
parent 650244 60b14c9d149f633c08c10bab455f7afe7bec1bec
child 727328 9fc5c08795c649ff433b078c0afd8839e923fcc6
push id75302
push userbmo:jolin@mozilla.com
push dateTue, 22 Aug 2017 02:08:52 +0000
reviewersjwwang
bugs1391556
milestone57.0a1
Bug 1391556 - fix incorrect out of bound check. r?jwwang MozReview-Commit-ID: JytNgl6bqCX
media/libstagefright/system/core/liblog/fake_log_device.c
--- a/media/libstagefright/system/core/liblog/fake_log_device.c
+++ b/media/libstagefright/system/core/liblog/fake_log_device.c
@@ -146,17 +146,17 @@ static LogState *openLogTable[MAX_OPEN_L
 /*
  * Allocate an fd and associate a new LogState with it.
  * The fd is available via the fakeFd field of the return value.
  */
 static LogState *createLogState()
 {
     size_t i;
 
-    for (i = 0; i < sizeof(openLogTable); i++) {
+    for (i = 0; i < MAX_OPEN_LOGS; i++) {
         if (openLogTable[i] == NULL) {
             openLogTable[i] = calloc(1, sizeof(LogState));
             openLogTable[i]->fakeFd = FAKE_FD_BASE + i;
             return openLogTable[i];
         }
     }
     return NULL;
 }