Merge "NativeLibraryHelper: Minor fixes"

This commit is contained in:
Treehugger Robot
2016-12-16 18:31:25 +00:00
committed by Gerrit Code Review

View File

@@ -243,7 +243,7 @@ copyFileIfChanged(JNIEnv *env, void* arg, ZipFileRO* zipFile, ZipEntryRO zipEntr
return INSTALL_FAILED_INTERNAL_ERROR;
}
*(localFileName + nativeLibPath.size()) = '/';
*(localTmpFileName + nativeLibPath.size()) = '/';
if (strlcpy(localTmpFileName + nativeLibPath.size(), TMP_FILE_PATTERN,
TMP_FILE_PATTERN_LEN - nativeLibPath.size()) != TMP_FILE_PATTERN_LEN) {
@@ -344,6 +344,11 @@ public:
const char* lastSlash = strrchr(fileName, '/');
ALOG_ASSERT(lastSlash != NULL, "last slash was null somehow for %s\n", fileName);
// Skip directories.
if (*(lastSlash + 1) == 0) {
continue;
}
// Make sure the filename is safe.
if (!isFilenameSafe(lastSlash + 1)) {
continue;