diff options
author | Ningyuan Wang <nywang@google.com> | 2017-06-07 00:09:53 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-06-07 00:09:53 +0000 |
commit | 009fed0b61c98d02298d7ee1f8e82be11c9779ab (patch) | |
tree | c4ada22ffd313c0dc0aa7797921741ebdd098d77 /service | |
parent | 0dffd1db0778b502198256e3d7a7a75976867cef (diff) | |
parent | 0025d7cad0fdde7f0857d898fa0a55b9e7a76d36 (diff) |
cherry-pick: wifinative jni: check array length for trackSignificantWifiChange am: dc96644e72 am: 011d4fa368 am: f486419a93 am: dc1745a1e4 am: af4c3a895f am: 6cf037d921
am: 0025d7cad0
Change-Id: I00cb9e2789f37f8654513c0ed42c0fbfd837c428
Diffstat (limited to 'service')
-rw-r--r-- | service/jni/com_android_server_wifi_WifiNative.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/service/jni/com_android_server_wifi_WifiNative.cpp b/service/jni/com_android_server_wifi_WifiNative.cpp index ad7d464ae..ffd5b559f 100644 --- a/service/jni/com_android_server_wifi_WifiNative.cpp +++ b/service/jni/com_android_server_wifi_WifiNative.cpp @@ -49,6 +49,7 @@ extern "C" jint Java_com_android_server_wifi_WifiNative_registerNanNatives(JNIEnv* env, jclass clazz); static jint DBG = false; +constexpr int SAFE_NET_LOG_ID = 0x534e4554; //Please put all HAL function call here and call from the function table instead of directly call wifi_hal_fn hal_fn; @@ -790,7 +791,7 @@ static jboolean android_net_wifi_setHotlist( if (params.num_bssid > static_cast<int>(sizeof(params.ap) / sizeof(params.ap[0]))) { ALOGE("setHotlist array length is too long"); - android_errorWriteLog(0x534e4554, "31856351"); + android_errorWriteLog(SAFE_NET_LOG_ID, "31856351"); return false; } @@ -909,7 +910,12 @@ static jboolean android_net_wifi_trackSignificantWifiChange( ALOGE("BssidInfo array length was 0"); return false; } - + if (params.num_bssid > + static_cast<int>(sizeof(params.ap) / sizeof(params.ap[0]))) { + ALOGE("trackSignificantWifiChange array length is too long"); + android_errorWriteLog(SAFE_NET_LOG_ID, "37775935"); + return false; + } ALOGD("Initialized common fields %d, %d, %d, %d", params.rssi_sample_size, params.lost_ap_sample_size, params.min_breaching, params.num_bssid); |