am ce3ac5f0: Merge "Corrected buffer overflow when parsing /proc/wakelocks"
Merge commit 'ce3ac5f02970fcab91e16ecb573931d209b1985c' into gingerbread-plus-aosp * commit 'ce3ac5f02970fcab91e16ecb573931d209b1985c': Corrected buffer overflow when parsing /proc/wakelocks
This commit is contained in:
@@ -911,7 +911,7 @@ public final class BatteryStatsImpl extends BatteryStats {
|
|||||||
|
|
||||||
private final Map<String, KernelWakelockStats> readKernelWakelockStats() {
|
private final Map<String, KernelWakelockStats> readKernelWakelockStats() {
|
||||||
|
|
||||||
byte[] buffer = new byte[4096];
|
byte[] buffer = new byte[8192];
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -958,9 +958,11 @@ public final class BatteryStatsImpl extends BatteryStats {
|
|||||||
for (endIndex=startIndex;
|
for (endIndex=startIndex;
|
||||||
endIndex < len && wlBuffer[endIndex] != '\n' && wlBuffer[endIndex] != '\0';
|
endIndex < len && wlBuffer[endIndex] != '\n' && wlBuffer[endIndex] != '\0';
|
||||||
endIndex++);
|
endIndex++);
|
||||||
// Don't go over the end of the buffer
|
endIndex++; // endIndex is an exclusive upper bound.
|
||||||
if (endIndex < len) {
|
// Don't go over the end of the buffer, Process.parseProcLine might
|
||||||
endIndex++; // endIndex is an exclusive upper bound.
|
// write to wlBuffer[endIndex]
|
||||||
|
if (endIndex >= (len - 1) ) {
|
||||||
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] nameStringArray = mProcWakelocksName;
|
String[] nameStringArray = mProcWakelocksName;
|
||||||
|
|||||||
Reference in New Issue
Block a user