From 0857f72a75b7719ee0907ea3b8d4400ac5c8fed1 Mon Sep 17 00:00:00 2001 From: Keith Mok Date: Thu, 13 Jan 2022 19:02:41 +0000 Subject: android_util_Process: fix length checking logic The length should be checked first before access it Test: m Change-Id: I540301c9a30c2fe441562d7a047c06011efd8fbe --- core/jni/android_util_Process.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp index 4d8d4dbf67fa..71b51ff8fbb6 100644 --- a/core/jni/android_util_Process.cpp +++ b/core/jni/android_util_Process.cpp @@ -991,7 +991,7 @@ jboolean android_os_Process_parseProcLineArray(JNIEnv* env, jobject clazz, end = i; i++; } else if ((mode&PROC_QUOTES) != 0) { - while (buffer[i] != '"' && i < endIndex) { + while (i < endIndex && buffer[i] != '"') { i++; } end = i; -- cgit v1.2.3-59-g8ed1b