Flawfinder version 2.0.10, (C) 2001-2019 David A. Wheeler. Number of rules (primarily dangerous function names) in C/C++ ruleset: 223 Examining data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp Examining data/android-platform-dalvik-8.1.0+r23/libdex/CmdUtils.cpp Examining data/android-platform-dalvik-8.1.0+r23/libdex/CmdUtils.h Examining data/android-platform-dalvik-8.1.0+r23/libdex/DexCatch.cpp Examining data/android-platform-dalvik-8.1.0+r23/libdex/DexCatch.h Examining data/android-platform-dalvik-8.1.0+r23/libdex/DexClass.cpp Examining data/android-platform-dalvik-8.1.0+r23/libdex/DexClass.h Examining data/android-platform-dalvik-8.1.0+r23/libdex/DexDataMap.cpp Examining data/android-platform-dalvik-8.1.0+r23/libdex/DexDataMap.h Examining data/android-platform-dalvik-8.1.0+r23/libdex/DexDebugInfo.cpp Examining data/android-platform-dalvik-8.1.0+r23/libdex/DexDebugInfo.h Examining data/android-platform-dalvik-8.1.0+r23/libdex/DexFile.cpp Examining data/android-platform-dalvik-8.1.0+r23/libdex/DexFile.h Examining data/android-platform-dalvik-8.1.0+r23/libdex/DexInlines.cpp Examining data/android-platform-dalvik-8.1.0+r23/libdex/DexOpcodes.cpp Examining data/android-platform-dalvik-8.1.0+r23/libdex/DexOpcodes.h Examining data/android-platform-dalvik-8.1.0+r23/libdex/DexOptData.cpp Examining data/android-platform-dalvik-8.1.0+r23/libdex/DexOptData.h Examining data/android-platform-dalvik-8.1.0+r23/libdex/DexProto.cpp Examining data/android-platform-dalvik-8.1.0+r23/libdex/DexProto.h Examining data/android-platform-dalvik-8.1.0+r23/libdex/DexSwapVerify.cpp Examining data/android-platform-dalvik-8.1.0+r23/libdex/DexUtf.cpp Examining data/android-platform-dalvik-8.1.0+r23/libdex/DexUtf.h Examining data/android-platform-dalvik-8.1.0+r23/libdex/InstrUtils.cpp Examining data/android-platform-dalvik-8.1.0+r23/libdex/InstrUtils.h Examining data/android-platform-dalvik-8.1.0+r23/libdex/Leb128.cpp Examining data/android-platform-dalvik-8.1.0+r23/libdex/Leb128.h Examining data/android-platform-dalvik-8.1.0+r23/libdex/OptInvocation.cpp Examining data/android-platform-dalvik-8.1.0+r23/libdex/OptInvocation.h Examining data/android-platform-dalvik-8.1.0+r23/libdex/SysUtil.cpp Examining data/android-platform-dalvik-8.1.0+r23/libdex/SysUtil.h Examining data/android-platform-dalvik-8.1.0+r23/libdex/ZipArchive.h Examining data/android-platform-dalvik-8.1.0+r23/libdex/sha1.cpp Examining data/android-platform-dalvik-8.1.0+r23/libdex/sha1.h Examining data/android-platform-dalvik-8.1.0+r23/tools/hprof-conv/HprofConv.c FINAL RESULTS: data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:1131:13: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(" v%d, #double %f // #%016" PRIx64, data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:1997:9: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(doXml ? "<call_site index=\"%u\" offset=\"%u\">\n" : "Call Site #%u // offset %u\n", data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:2002:13: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(doXml ? "<link_argument index=\"%u\" " : " link_argument[%u] : ", i); data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:2008:21: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(doXml ? "type=\"byte\" value=\"%d\"/>" : "%d (byte)", (int)*data++); data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:2012:21: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(doXml ? "type=\"short\" value=\"%d\"/>" : "%d (short)", data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:2017:21: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(doXml ? "type=\"short\" value=\"%u\"/>" : "%u (char)", data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:2022:21: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(doXml ? "type=\"int\" value=\"%d\"/>" : "%d (int)", data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:2027:21: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(doXml ? "type=\"long\" value=\"%" PRId64 "\"/>" : "%" PRId64 " (long)", data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:2033:21: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(doXml ? "type=\"float\" value=\"%g\"/>" : "%g (float)", data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:2039:21: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(doXml ? "type=\"double\" value=\"%g\"/>" : "%g (double)", data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:2048:21: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(doXml ? "type=\"MethodType\" value=\"(%s)%s\"/>" : "(%s)%s (MethodType)", data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:2055:21: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(doXml ? "type=\"MethodHandle\" value=\"%u\"/>" : "%u (MethodHandle)", data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:2061:21: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(doXml ? "type=\"String\" value=\"%s\"/>" : "%s (String)", data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:2067:21: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(doXml ? "type=\"Class\" value=\"%s\"/>" : "%s (Class)", data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:2072:21: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(doXml ? "type=\"null\" value=\"null\"/>" : "null (null)"); data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:2076:21: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(doXml ? "type=\"boolean\" value=\"%s\"/>" : "%s (boolean)", data/android-platform-dalvik-8.1.0+r23/libdex/CmdUtils.cpp:140:17: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access("/tmp", W_OK) == 0) { data/android-platform-dalvik-8.1.0+r23/libdex/CmdUtils.cpp:142:24: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. } else if (access("/sdcard", W_OK) == 0) { data/android-platform-dalvik-8.1.0+r23/libdex/DexProto.cpp:157:9: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(at, desc); data/android-platform-dalvik-8.1.0+r23/libdex/DexProto.cpp:163:5: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(at, dexStringByTypeIdx(dexFile, protoId->returnTypeIdx)); data/android-platform-dalvik-8.1.0+r23/libdex/DexProto.cpp:204:9: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(at, descriptor); data/android-platform-dalvik-8.1.0+r23/libdex/sha1.cpp:467:17: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s%s%s", drive, dir, f.ff_name); data/android-platform-dalvik-8.1.0+r23/tools/hprof-conv/HprofConv.c:32:20: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. # define DBUG(...) fprintf(stderr, __VA_ARGS__) data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:2221:14: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. ic = getopt(argc, argv, "cdfhil:mt:"); data/android-platform-dalvik-8.1.0+r23/libdex/OptInvocation.cpp:117:16: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. dataRoot = getenv("ANDROID_DATA"); data/android-platform-dalvik-8.1.0+r23/tools/hprof-conv/HprofConv.c:717:19: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((opt = getopt(argc, argv, "z")) != -1) { data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:351:13: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(cp, accessStr, len); data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:404:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char sanitized[sizeof(pHeader->magic)*2 +1]; data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:1359:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tmpBuf[strlen(typeDescriptor)+1]; /* more than big enough */ data/android-platform-dalvik-8.1.0+r23/libdex/CmdUtils.cpp:57:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open(outFileName, O_RDWR | O_CREAT | O_EXCL | O_BINARY, 0600); data/android-platform-dalvik-8.1.0+r23/libdex/CmdUtils.cpp:115:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tempNameBuf[32]; data/android-platform-dalvik-8.1.0+r23/libdex/CmdUtils.cpp:141:17: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(tempNameBuf, "/tmp/dex-temp-%d", getpid()); data/android-platform-dalvik-8.1.0+r23/libdex/CmdUtils.cpp:143:17: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(tempNameBuf, "/sdcard/dex-temp-%d", getpid()); data/android-platform-dalvik-8.1.0+r23/libdex/CmdUtils.cpp:147:17: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(tempNameBuf, "dex-temp-%d", getpid()); data/android-platform-dalvik-8.1.0+r23/libdex/CmdUtils.cpp:176:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open(fileName, O_RDONLY | O_BINARY); data/android-platform-dalvik-8.1.0+r23/libdex/DexFile.cpp:380:18: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char sha1Digest[kSHA1DigestLen]; data/android-platform-dalvik-8.1.0+r23/libdex/DexFile.cpp:386:13: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tmpBuf1[kSHA1DigestOutputLen]; data/android-platform-dalvik-8.1.0+r23/libdex/DexFile.cpp:387:13: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tmpBuf2[kSHA1DigestOutputLen]; data/android-platform-dalvik-8.1.0+r23/libdex/DexProto.cpp:86:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(pCache->value, value, length); data/android-platform-dalvik-8.1.0+r23/libdex/DexProto.h:36:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[120]; /* buffer used to hold small-enough results */ data/android-platform-dalvik-8.1.0+r23/libdex/OptInvocation.cpp:70:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char nameBuf[512]; data/android-platform-dalvik-8.1.0+r23/libdex/OptInvocation.cpp:71:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char absoluteFile[sizeof(nameBuf)]; data/android-platform-dalvik-8.1.0+r23/libdex/SysUtil.cpp:309:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(dst, src, sizeof(MemMapping)); data/android-platform-dalvik-8.1.0+r23/libdex/SysUtil.cpp:340:14: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char buf[kBufSize]; data/android-platform-dalvik-8.1.0+r23/libdex/sha1.cpp:105:20: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. const unsigned char buffer[64]); data/android-platform-dalvik-8.1.0+r23/libdex/sha1.cpp:133:20: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. const unsigned char buffer[64]) data/android-platform-dalvik-8.1.0+r23/libdex/sha1.cpp:137:14: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char c[64]; data/android-platform-dalvik-8.1.0+r23/libdex/sha1.cpp:142:17: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static unsigned char workspace[64]; data/android-platform-dalvik-8.1.0+r23/libdex/sha1.cpp:144:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(block, buffer, 64); data/android-platform-dalvik-8.1.0+r23/libdex/sha1.cpp:223:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(&context->buffer[j], data, (i = 64-j)); data/android-platform-dalvik-8.1.0+r23/libdex/sha1.cpp:232:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(&context->buffer[j], &data[i], len - i); data/android-platform-dalvik-8.1.0+r23/libdex/sha1.cpp:238:25: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. void SHA1Final(unsigned char digest[HASHSIZE], SHA1_CTX* data/android-platform-dalvik-8.1.0+r23/libdex/sha1.cpp:242:10: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char finalcount[8]; data/android-platform-dalvik-8.1.0+r23/libdex/sha1.cpp:283:14: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char buffer[16384]; data/android-platform-dalvik-8.1.0+r23/libdex/sha1.cpp:288:13: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). f = fopen(fname, "rb"); data/android-platform-dalvik-8.1.0+r23/libdex/sha1.cpp:330:14: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char digest[HASHSIZE]; data/android-platform-dalvik-8.1.0+r23/libdex/sha1.cpp:331:14: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char expected_digest[HASHSIZE]; data/android-platform-dalvik-8.1.0+r23/libdex/sha1.cpp:333:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char checkline[LINESIZE]; data/android-platform-dalvik-8.1.0+r23/libdex/sha1.cpp:337:17: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). checkfile = fopen(fname, "rt"); data/android-platform-dalvik-8.1.0+r23/libdex/sha1.cpp:421:14: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char digest[HASHSIZE]; data/android-platform-dalvik-8.1.0+r23/libdex/sha1.cpp:422:14: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char expected_digest[HASHSIZE]; data/android-platform-dalvik-8.1.0+r23/libdex/sha1.cpp:424:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char checkline[LINESIZE]; data/android-platform-dalvik-8.1.0+r23/libdex/sha1.cpp:429:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char path[MAXPATH]; data/android-platform-dalvik-8.1.0+r23/libdex/sha1.cpp:430:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char drive[MAXDRIVE]; data/android-platform-dalvik-8.1.0+r23/libdex/sha1.cpp:431:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char dir[MAXDIR]; data/android-platform-dalvik-8.1.0+r23/libdex/sha1.cpp:432:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char name[MAXFILE]; data/android-platform-dalvik-8.1.0+r23/libdex/sha1.cpp:433:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char ext[MAXEXT]; data/android-platform-dalvik-8.1.0+r23/libdex/sha1.h:10:14: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char buffer[64]; data/android-platform-dalvik-8.1.0+r23/libdex/sha1.h:18:25: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. void SHA1Final(unsigned char digest[HASHSIZE], SHA1_CTX* context); data/android-platform-dalvik-8.1.0+r23/tools/hprof-conv/HprofConv.c:202:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(pBuf->storage + pBuf->curLen, data, count); data/android-platform-dalvik-8.1.0+r23/tools/hprof-conv/HprofConv.c:705:16: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). return fopen(path, mode); data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:136:21: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). int targetLen = strlen(str); data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:152:21: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). targetLen = strlen(str); data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:203:12: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). newStr[strlen(lastSlash)-1] = '\0'; data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:347:23: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). int len = strlen(accessStr); data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:741:36: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t newUsed = bufUsed + strlen(param); data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:751:9: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(buf + bufUsed - 1, param, bufSize - (bufUsed - 1)); data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:1359:21: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). char tmpBuf[strlen(typeDescriptor)+1]; /* more than big enough */ data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:1514:27: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). classDescriptor[strlen(classDescriptor)-1] == ';')) data/android-platform-dalvik-8.1.0+r23/dexdump/DexDump.cpp:1525:16: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). mangle[strlen(mangle)-1] = '\0'; data/android-platform-dalvik-8.1.0+r23/libdex/CmdUtils.cpp:114:15: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). int len = strlen(fileName); data/android-platform-dalvik-8.1.0+r23/libdex/DexProto.cpp:84:25: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t length = strlen(value) + 1; data/android-platform-dalvik-8.1.0+r23/libdex/DexProto.cpp:144:19: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). length += strlen(dexStringByTypeIdx(dexFile, idx)); data/android-platform-dalvik-8.1.0+r23/libdex/DexProto.cpp:147:15: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). length += strlen(dexStringByTypeIdx(dexFile, protoId->returnTypeIdx)); data/android-platform-dalvik-8.1.0+r23/libdex/DexProto.cpp:158:15: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). at += strlen(desc); data/android-platform-dalvik-8.1.0+r23/libdex/DexProto.cpp:190:19: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). length += strlen(descriptor); data/android-platform-dalvik-8.1.0+r23/libdex/DexProto.cpp:205:15: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). at += strlen(descriptor); data/android-platform-dalvik-8.1.0+r23/libdex/OptInvocation.cpp:90:9: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant character. strncat(absoluteFile, "/", kBufLen - strlen(absoluteFile)); data/android-platform-dalvik-8.1.0+r23/libdex/OptInvocation.cpp:90:46: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strncat(absoluteFile, "/", kBufLen - strlen(absoluteFile)); data/android-platform-dalvik-8.1.0+r23/libdex/OptInvocation.cpp:92:5: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(absoluteFile, fileName, kBufLen - strlen(absoluteFile)); data/android-platform-dalvik-8.1.0+r23/libdex/OptInvocation.cpp:92:47: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strncat(absoluteFile, fileName, kBufLen - strlen(absoluteFile)); data/android-platform-dalvik-8.1.0+r23/libdex/OptInvocation.cpp:100:9: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant character. strncat(absoluteFile, "/", kBufLen - strlen(absoluteFile)); data/android-platform-dalvik-8.1.0+r23/libdex/OptInvocation.cpp:100:46: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strncat(absoluteFile, "/", kBufLen - strlen(absoluteFile)); data/android-platform-dalvik-8.1.0+r23/libdex/OptInvocation.cpp:101:9: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(absoluteFile, subFileName, kBufLen - strlen(absoluteFile)); data/android-platform-dalvik-8.1.0+r23/libdex/OptInvocation.cpp:101:54: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strncat(absoluteFile, subFileName, kBufLen - strlen(absoluteFile)); data/android-platform-dalvik-8.1.0+r23/libdex/OptInvocation.cpp:139:5: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(nameBuf, absoluteFile, kBufLen - strlen(nameBuf)); data/android-platform-dalvik-8.1.0+r23/libdex/OptInvocation.cpp:139:46: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strncat(nameBuf, absoluteFile, kBufLen - strlen(nameBuf)); data/android-platform-dalvik-8.1.0+r23/libdex/SysUtil.cpp:126:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, memPtr, length) < 0) { data/android-platform-dalvik-8.1.0+r23/libdex/SysUtil.cpp:345:45: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t actual = TEMP_FAILURE_RETRY(read(inFd, buf, getSize)); data/android-platform-dalvik-8.1.0+r23/libdex/sha1.cpp:348:18: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if ((strlen(checkline)>26)&& data/android-platform-dalvik-8.1.0+r23/libdex/sha1.cpp:352:27: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). checkline[strlen(checkline)-1]=0; data/android-platform-dalvik-8.1.0+r23/tools/hprof-conv/HprofConv.c:217:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ic = getc(in); ANALYSIS SUMMARY: Hits = 102 Lines analyzed = 14002 in approximately 0.60 seconds (23322 lines/second) Physical Source Lines of Code (SLOC) = 9327 Hits@level = [0] 279 [1] 31 [2] 45 [3] 3 [4] 23 [5] 0 Hits@level+ = [0+] 381 [1+] 102 [2+] 71 [3+] 26 [4+] 23 [5+] 0 Hits/KSLOC@level+ = [0+] 40.8491 [1+] 10.936 [2+] 7.61231 [3+] 2.78761 [4+] 2.46596 [5+] 0 Dot directories skipped = 1 (--followdotdir overrides) Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code! See 'Secure Programming HOWTO' (https://dwheeler.com/secure-programs) for more information.