diff options
author | Ningyuan Wang <nywang@google.com> | 2017-06-06 23:56:05 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-06-06 23:56:05 +0000 |
commit | 6cf037d921ae0ce0c4c07f985b87ed1447e72aa9 (patch) | |
tree | 1bfb5ebeab4aef5f00280e00503993d4a8d2e744 /service | |
parent | bd91d4a476b2b5d4ab13658f8fb01415ea45f06f (diff) | |
parent | af4c3a895fb9ba8a300332aef0c858e7d76aec1c (diff) |
cherry-pick: wifinative jni: check array length for trackSignificantWifiChange am: dc96644e72 am: 011d4fa368 am: f486419a93 am: dc1745a1e4
am: af4c3a895f
Change-Id: I9173232ae84b48ad7eb683188fe5dd1c8f3ddea5
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 462defd8d..f838a152c 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); |