diff options
| author | 2017-01-06 00:25:28 +0000 | |
|---|---|---|
| committer | 2017-01-06 00:25:28 +0000 | |
| commit | bd38f6f4f8abea71711e7ef129e6706e56b3bfdc (patch) | |
| tree | c13f30a502d50d30e8821f6bfb1760c30ecfab93 | |
| parent | 7495cf633ccfb9bca025c7489337290bd531ed48 (diff) | |
| parent | 1d8995aa9c64b459aa4007f3104a7a7f3d277377 (diff) | |
Merge "Fix stack-buffer-overflow detected by AddressSanitizer."
am: 1d8995aa9c
Change-Id: I65a468b94b1bc927bb4cff8b08a08dc6a8aca09e
| -rw-r--r-- | core/jni/android_hardware_location_ContextHubService.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/core/jni/android_hardware_location_ContextHubService.cpp b/core/jni/android_hardware_location_ContextHubService.cpp index 8eb39e1aac58..fbccfd5532e2 100644 --- a/core/jni/android_hardware_location_ContextHubService.cpp +++ b/core/jni/android_hardware_location_ContextHubService.cpp @@ -33,6 +33,7 @@ #include <unordered_map> #include <queue> +#include <android-base/macros.h> #include <cutils/log.h> #include "JNIHelp.h" @@ -704,10 +705,10 @@ static void passOnOsResponse(uint32_t hubHandle, uint32_t msgType, } jbyteArray jmsg = env->NewByteArray(msgLen); - jintArray jheader = env->NewIntArray(sizeof(header)); + jintArray jheader = env->NewIntArray(arraysize(header)); env->SetByteArrayRegion(jmsg, 0, msgLen, (jbyte *)msg); - env->SetIntArrayRegion(jheader, 0, sizeof(header), (jint *)header); + env->SetIntArrayRegion(jheader, 0, arraysize(header), (jint *)header); ALOGI("Passing msg type %" PRIu32 " from app %" PRIu32 " from hub %" PRIu32, header[HEADER_FIELD_MSG_TYPE], header[HEADER_FIELD_APP_INSTANCE], |