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/smpq-1.6/rename.c Examining data/smpq-1.6/remove.c Examining data/smpq-1.6/print.c Examining data/smpq-1.6/mangen.c Examining data/smpq-1.6/main.c Examining data/smpq-1.6/listfiles.c Examining data/smpq-1.6/kio_smpq.h Examining data/smpq-1.6/kio_smpq.cpp Examining data/smpq-1.6/info.c Examining data/smpq-1.6/extract.c Examining data/smpq-1.6/dirname.c Examining data/smpq-1.6/common.h Examining data/smpq-1.6/check.c Examining data/smpq-1.6/append.c FINAL RESULTS: data/smpq-1.6/common.h:233:2: [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(to, from); data/smpq-1.6/extract.c:273:4: [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(SFileFindData.cFileName, mask); data/smpq-1.6/listfiles.c:72:3: [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(listfile, LISTPATH); data/smpq-1.6/listfiles.c:73:3: [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(listfile+strlen(LISTPATH) + 1, FindFileData.cFileName); data/smpq-1.6/listfiles.c:108:3: [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(listfile, LISTPATH); data/smpq-1.6/listfiles.c:109:3: [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(listfile+strlen(LISTPATH)+1, ent->d_name); data/smpq-1.6/main.c:278:4: [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(HELP); data/smpq-1.6/main.c:283:4: [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(LICENSE "\n\nSMPQ use %s\n", StormLibCopyright); data/smpq-1.6/print.c:60:2: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(message, ap); data/smpq-1.6/append.c:249:3: [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 SFileName[1024]; data/smpq-1.6/append.c:252:3: [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[0x10000]; data/smpq-1.6/append.c:284:10: [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). file = fopen(fileName, "rb"); data/smpq-1.6/extract.c:214:29: [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. if ( ( parchive = strchr((char *)parchives[i], ':') ) ) { data/smpq-1.6/extract.c:222:16: [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. parchive = (char *)parchives[i]; data/smpq-1.6/extract.c:256:3: [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 mask[512]; data/smpq-1.6/extract.c:296:4: [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 fileName[1024]; data/smpq-1.6/extract.c:297:4: [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 fileDir[1024]; data/smpq-1.6/extract.c:306:4: [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[0x10000]; data/smpq-1.6/extract.c:345: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 strtime[80]; data/smpq-1.6/extract.c:354:4: [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(fileDir, fileName, last); data/smpq-1.6/extract.c:408:12: [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). file = fopen(fileName, "wb"); data/smpq-1.6/kio_smpq.cpp:382:14: [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). if ( ! file.open() ) { data/smpq-1.6/kio_smpq.cpp:911:17: [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). void SMPQSlave::open(const KUrl &url, QIODevice::OpenMode mode) { data/smpq-1.6/kio_smpq.h:61:16: [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). virtual void open(const KUrl &url, QIODevice::OpenMode mode); data/smpq-1.6/listfiles.c:48:2: [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 processPath[512]; data/smpq-1.6/listfiles.c:100:3: [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 listfile[1024]; data/smpq-1.6/main.c:422:17: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). mpq_version = atoi(argv[skipArg[MPQ_VERSION_ARG]]); data/smpq-1.6/main.c:480:12: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). locale = atoi(argv[skipArg[LOCALE_ARG]]); data/smpq-1.6/main.c:493:18: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). maxFileCount = atoi(argv[skipArg[MAX_FILE_COUNT_ARG]]); data/smpq-1.6/remove.c:64:3: [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 SFileName[1024]; data/smpq-1.6/append.c:255:8: [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(fileName) + 1 > 1024 ) { data/smpq-1.6/append.c:266:8: [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(SFileName) == 16 && strncasecmp(SFileName, "File", 4) == 0 && SFileName[12] == '.' ) { data/smpq-1.6/extract.c:138: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). unsigned int len = strlen(str); data/smpq-1.6/extract.c:158: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). unsigned int len = strlen(str); data/smpq-1.6/extract.c:309:9: [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(SFileFindData.cFileName)+1 > 1024 ) data/smpq-1.6/kio_smpq.cpp:439:26: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ( ( buffer = file.read(0x10000) ).size() > 0 ) { data/smpq-1.6/kio_smpq.cpp:1055:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void SMPQSlave::read(KIO::filesize_t size) { data/smpq-1.6/kio_smpq.h:63:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). virtual void read(KIO::filesize_t size); data/smpq-1.6/listfiles.c:67:29: [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). listfile = (char *)malloc(strlen(LISTPATH) + strlen(FindFileData.cFileName) + 2); data/smpq-1.6/listfiles.c:67:48: [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). listfile = (char *)malloc(strlen(LISTPATH) + strlen(FindFileData.cFileName) + 2); data/smpq-1.6/listfiles.c:73: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). strcpy(listfile+strlen(LISTPATH) + 1, FindFileData.cFileName); data/smpq-1.6/listfiles.c:74: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). listfile[strlen(LISTPATH)] = '\\'; data/smpq-1.6/listfiles.c:102:8: [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(LISTPATH)+strlen(ent->d_name)+2 > 1024 ) data/smpq-1.6/listfiles.c:102: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). if ( strlen(LISTPATH)+strlen(ent->d_name)+2 > 1024 ) data/smpq-1.6/listfiles.c:105:31: [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 ( strcasecmp(ent->d_name+strlen(ent->d_name)-4, ".txt") != 0 ) data/smpq-1.6/listfiles.c:109: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). strcpy(listfile+strlen(LISTPATH)+1, ent->d_name); data/smpq-1.6/listfiles.c:110: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). listfile[strlen(LISTPATH)] = '/'; data/smpq-1.6/main.c:394: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). for ( j = 1; j < (int)strlen(argv[i]); ++j ) data/smpq-1.6/main.c:512:42: [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 ( ! ( flags & MPQ_NOT_ENCRYPTED ) && strlen(archive) > 5 && strcasecmp(archive+strlen(archive)-5, ".mpqe") == 0 ) data/smpq-1.6/main.c:512:84: [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 ( ! ( flags & MPQ_NOT_ENCRYPTED ) && strlen(archive) > 5 && strcasecmp(archive+strlen(archive)-5, ".mpqe") == 0 ) data/smpq-1.6/mangen.c:41:29: [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). const char * len = start + strlen(HELP) + 1; data/smpq-1.6/mangen.c:54:13: [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). next += strlen("smpq"); data/smpq-1.6/remove.c:66:8: [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(fileName)+1 > 1024 ) ANALYSIS SUMMARY: Hits = 53 Lines analyzed = 3720 in approximately 0.10 seconds (37943 lines/second) Physical Source Lines of Code (SLOC) = 2161 Hits@level = [0] 26 [1] 23 [2] 21 [3] 0 [4] 9 [5] 0 Hits@level+ = [0+] 79 [1+] 53 [2+] 30 [3+] 9 [4+] 9 [5+] 0 Hits/KSLOC@level+ = [0+] 36.5571 [1+] 24.5257 [2+] 13.8825 [3+] 4.16474 [4+] 4.16474 [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.