Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff74e22b authored by Romain Guy's avatar Romain Guy Committed by Android Git Automerger
Browse files

am ce3ac5f0: Merge "Corrected buffer overflow when parsing /proc/wakelocks"

Merge commit 'ce3ac5f0' into gingerbread-plus-aosp

* commit 'ce3ac5f0':
  Corrected buffer overflow when parsing /proc/wakelocks
parents 0f0b7160 ce3ac5f0
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -911,7 +911,7 @@ public final class BatteryStatsImpl extends BatteryStats {
    
    private final Map<String, KernelWakelockStats> readKernelWakelockStats() {
        
        byte[] buffer = new byte[4096];
        byte[] buffer = new byte[8192];
        int len;
        
        try {
@@ -958,9 +958,11 @@ public final class BatteryStatsImpl extends BatteryStats {
                for (endIndex=startIndex; 
                        endIndex < len && wlBuffer[endIndex] != '\n' && wlBuffer[endIndex] != '\0'; 
                        endIndex++);
                // Don't go over the end of the buffer
                if (endIndex < len) {
                endIndex++; // endIndex is an exclusive upper bound.
                // Don't go over the end of the buffer, Process.parseProcLine might
                // write to wlBuffer[endIndex]
                if (endIndex >= (len - 1) ) {
                    return m;
                }

                String[] nameStringArray = mProcWakelocksName;