Exploit databaseDownload repository ZIP
GH-87d78a8273b7c916c0f9f9ca25ca743e
trinadh465/frameworks_base_aosp10_r33_cve-2022-20007
Sources for CVE-2022-20007
2 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files52
trinadh465/frameworks_base_aosp10_r33_cve-2022-20007Revision d046b4eb34eb
- ↑..Parent directory
- tests/
- AaptAssets.cpp
- AaptAssets.h
- AaptConfig.cpp
- AaptConfig.h
- AaptUtil.cpp
- AaptUtil.h
- AaptXml.cpp
- AaptXml.h
- Android.bp
- ApkBuilder.cpp
- ApkBuilder.h
- Bundle.h
- CacheUpdater.h
- Command.cpp
- ConfigDescription.h
- CrunchCache.cpp
- CrunchCache.h
- DirectoryWalker.h
- FileFinder.cpp
- FileFinder.h
- Images.cpp
- Images.h
- IndentPrinter.h
- Main.cpp
- Main.h
- NOTICE
- OutputSet.h
- Package.cpp
- Resource.cpp
- ResourceFilter.cpp
- ResourceFilter.h
- ResourceIdCache.cpp
- ResourceIdCache.h
- ResourceTable.cpp
- ResourceTable.h
- SdkConstants.h
- SourcePos.cpp
- SourcePos.h
- StringPool.cpp
- StringPool.h
- Symbol.h
- WorkQueue.cpp
- WorkQueue.h
- XMLNode.cpp
- XMLNode.h
- ZipEntry.cpp
- ZipEntry.h
- ZipFile.cpp
- ZipFile.h
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
tools/aapt/FileFinder.cpp
C++ · 2,895 bytes//
// Copyright 2011 The Android Open Source Project
//
// File Finder implementation.
// Implementation for the functions declared and documented in FileFinder.h
#include <utils/Vector.h>
#include <utils/String8.h>
#include <utils/KeyedVector.h>
#include <dirent.h>
#include <sys/stat.h>
#include "DirectoryWalker.h"
#include "FileFinder.h"
//#define DEBUG
using android::String8;
// Private function to check whether a file is a directory or not
bool isDirectory(const char* filename) {
struct stat fileStat;
if (stat(filename, &fileStat) == -1) {
return false;
}
return(S_ISDIR(fileStat.st_mode));
}
// Private function to check whether a file is a regular file or not
bool isFile(const char* filename) {
struct stat fileStat;
if (stat(filename, &fileStat) == -1) {
return false;
}
return(S_ISREG(fileStat.st_mode));
}
bool SystemFileFinder::findFiles(String8 basePath, Vector<String8>& extensions,
KeyedVector<String8,time_t>& fileStore,
DirectoryWalker* dw)
{
// Scan the directory pointed to by basePath
// check files and recurse into subdirectories.
if (!dw->openDir(basePath)) {
return false;
}
/*
* Go through all directory entries. Check each file using checkAndAddFile
* and recurse into sub-directories.
*/
struct dirent* entry;
while ((entry = dw->nextEntry()) != NULL) {
String8 entryName(entry->d_name);
if (entry->d_name[0] == '.') // Skip hidden files and directories
continue;
String8 fullPath = basePath.appendPathCopy(entryName);
// If this entry is a directory we'll recurse into it
if (isDirectory(fullPath.string()) ) {
DirectoryWalker* copy = dw->clone();
findFiles(fullPath, extensions, fileStore,copy);
delete copy;
}
// If this entry is a file, we'll pass it over to checkAndAddFile
if (isFile(fullPath.string()) ) {
checkAndAddFile(fullPath,dw->entryStats(),extensions,fileStore);
}
}
// Clean up
dw->closeDir();
return true;
}
void SystemFileFinder::checkAndAddFile(const String8& path, const struct stat* stats,
Vector<String8>& extensions,
KeyedVector<String8,time_t>& fileStore)
{
// Loop over the extensions, checking for a match
bool done = false;
String8 ext(path.getPathExtension());
ext.toLower();
for (size_t i = 0; i < extensions.size() && !done; ++i) {
String8 ext2 = extensions[i].getPathExtension();
ext2.toLower();
// Compare the extensions. If a match is found, add to storage.
if (ext == ext2) {
done = true;
fileStore.add(path,stats->st_mtime);
}
}
}