diff options
| author | 2017-12-16 00:24:47 +0000 | |
|---|---|---|
| committer | 2017-12-16 00:24:47 +0000 | |
| commit | 7ec82660768740b60210871e65b938e80ce1e877 (patch) | |
| tree | b1924f200c6d5aba095564807138513b11984707 | |
| parent | 6831a2646f8d25eb8ce33653e4d3ac0020fecae9 (diff) | |
| parent | 62fc14894b32f35641ae2b61ef7ed054c9660288 (diff) | |
Merge "Fix temporary file name strlcpy size."
| -rw-r--r-- | core/jni/com_android_internal_content_NativeLibraryHelper.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/core/jni/com_android_internal_content_NativeLibraryHelper.cpp b/core/jni/com_android_internal_content_NativeLibraryHelper.cpp index 17b98dade74f..cc2646cfb7c0 100644 --- a/core/jni/com_android_internal_content_NativeLibraryHelper.cpp +++ b/core/jni/com_android_internal_content_NativeLibraryHelper.cpp @@ -236,17 +236,15 @@ copyFileIfChanged(JNIEnv *env, void* arg, ZipFileRO* zipFile, ZipEntryRO zipEntr return INSTALL_SUCCEEDED; } - char localTmpFileName[nativeLibPath.size() + TMP_FILE_PATTERN_LEN + 2]; + char localTmpFileName[nativeLibPath.size() + TMP_FILE_PATTERN_LEN + 1]; if (strlcpy(localTmpFileName, nativeLibPath.c_str(), sizeof(localTmpFileName)) != nativeLibPath.size()) { ALOGD("Couldn't allocate local file name for library"); return INSTALL_FAILED_INTERNAL_ERROR; } - *(localTmpFileName + nativeLibPath.size()) = '/'; - if (strlcpy(localTmpFileName + nativeLibPath.size(), TMP_FILE_PATTERN, - TMP_FILE_PATTERN_LEN - nativeLibPath.size()) != TMP_FILE_PATTERN_LEN) { + TMP_FILE_PATTERN_LEN + 1) != TMP_FILE_PATTERN_LEN) { ALOGI("Couldn't allocate temporary file name for library"); return INSTALL_FAILED_INTERNAL_ERROR; } |