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/fatsort-1.6.3.622/src/regexlist.c Examining data/fatsort-1.6.3.622/src/misc.h Examining data/fatsort-1.6.3.622/src/misc.c Examining data/fatsort-1.6.3.622/src/errors.c Examining data/fatsort-1.6.3.622/src/stringlist.h Examining data/fatsort-1.6.3.622/src/natstrcmp.h Examining data/fatsort-1.6.3.622/src/natstrcmp.c Examining data/fatsort-1.6.3.622/src/mallocv.c Examining data/fatsort-1.6.3.622/src/clusterchain.h Examining data/fatsort-1.6.3.622/src/clusterchain.c Examining data/fatsort-1.6.3.622/src/sig.h Examining data/fatsort-1.6.3.622/src/sig.c Examining data/fatsort-1.6.3.622/src/errors.h Examining data/fatsort-1.6.3.622/src/sort.h Examining data/fatsort-1.6.3.622/src/entrylist.h Examining data/fatsort-1.6.3.622/src/endianness.h Examining data/fatsort-1.6.3.622/src/endianness.c Examining data/fatsort-1.6.3.622/src/mallocv.h Examining data/fatsort-1.6.3.622/src/regexlist.h Examining data/fatsort-1.6.3.622/src/entrylist.c Examining data/fatsort-1.6.3.622/src/FAT_fs.h Examining data/fatsort-1.6.3.622/src/options.h Examining data/fatsort-1.6.3.622/src/stringlist.c Examining data/fatsort-1.6.3.622/src/options.c Examining data/fatsort-1.6.3.622/src/fatsort.c Examining data/fatsort-1.6.3.622/src/deviceio.h Examining data/fatsort-1.6.3.622/src/deviceio.c Examining data/fatsort-1.6.3.622/src/sort.c Examining data/fatsort-1.6.3.622/src/FAT_fs.c FINAL RESULTS: data/fatsort-1.6.3.622/src/entrylist.c:83: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(tmp->sname, sname); data/fatsort-1.6.3.622/src/entrylist.c:90: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(tmp->lname, lname); data/fatsort-1.6.3.622/src/entrylist.c:479: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(new->name, name); data/fatsort-1.6.3.622/src/errors.c:37:2: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. vsnprintf(msg, 128, str, argptr); data/fatsort-1.6.3.622/src/fatsort.c:267:3: [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(INFO_OPTION_HELP); data/fatsort-1.6.3.622/src/fatsort.c:270:3: [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(INFO_OPTION_VERSION); data/fatsort-1.6.3.622/src/misc.c:39:3: [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(str,argptr); data/fatsort-1.6.3.622/src/FAT_fs.c:67:6: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. if (realpath(filename, rp_filename) == NULL) { data/fatsort-1.6.3.622/src/FAT_fs.c:73:7: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. if (realpath(mnt->mnt_fsname, rp_mnt_fsname) != NULL) { data/fatsort-1.6.3.622/src/FAT_fs.c:95:6: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. if (realpath(filename, rp_filename) == NULL) { data/fatsort-1.6.3.622/src/FAT_fs.c:108:3: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. realpath(mntbuf[i].f_mntfromname, rp_mnt_fsname); data/fatsort-1.6.3.622/src/fatsort.c:246:2: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand(time(0)); data/fatsort-1.6.3.622/src/options.c:240:12: [3] (buffer) getopt_long: 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 ((c=getopt_long(argc, argv, "imvhqcfo:lrRnd:D:x:X:I:taL:e:E:", longOpts, NULL)) != -1) { data/fatsort-1.6.3.622/src/FAT_fs.c:59: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 rp_filename[MAXPATHLEN+1], rp_mnt_fsname[MAXPATHLEN+1]; data/fatsort-1.6.3.622/src/FAT_fs.c:92: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 rp_filename[MAXPATHLEN], rp_mnt_fsname[MAXPATHLEN+1]; data/fatsort-1.6.3.622/src/FAT_fs.h:92: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 LDIR_Name1[10]; // Chars 1-5 of long name data/fatsort-1.6.3.622/src/FAT_fs.h:96: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 LDIR_Name2[12]; // Chars 6-11 of long name data/fatsort-1.6.3.622/src/FAT_fs.h:98: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 LDIR_Name3[4]; // Chars 12-13 of long name data/fatsort-1.6.3.622/src/FAT_fs.h:103: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 DIR_Name[11]; // Short name data/fatsort-1.6.3.622/src/FAT_fs.h:164: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 reserved[18]; data/fatsort-1.6.3.622/src/FAT_fs.h:200: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 filename[30]; // file name (part) data/fatsort-1.6.3.622/src/FAT_fs.h:222: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 BS_VolLab[11]; // Volume Label data/fatsort-1.6.3.622/src/FAT_fs.h:223: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 BS_FilSysType[8]; // FAT file system type (e.g. FAT, FAT12, FAT16, FAT32) data/fatsort-1.6.3.622/src/FAT_fs.h:235: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 BS_Reserved[12]; // for future expansion data/fatsort-1.6.3.622/src/FAT_fs.h:240: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 BS_VolLab[11]; data/fatsort-1.6.3.622/src/FAT_fs.h:241: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 BS_FilSysType[8]; data/fatsort-1.6.3.622/src/FAT_fs.h:311: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 BS_OEMName[8]; // OEM Name (padded with spaces) data/fatsort-1.6.3.622/src/FAT_fs.h:331: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 path[MAX_PATH_LEN+1]; data/fatsort-1.6.3.622/src/deviceio.c:71:11: [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 ((fd=open(path, O_RDWR | O_EXCL)) == -1) { data/fatsort-1.6.3.622/src/deviceio.c:229: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 drivePath[7]; data/fatsort-1.6.3.622/src/deviceio.c:383:7: [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(data, device->buffer+(device->currentOffset % device->sectorSize), remaining); data/fatsort-1.6.3.622/src/deviceio.c:387:7: [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(data, device->buffer+(device->currentOffset % device->sectorSize), device->sectorSize); data/fatsort-1.6.3.622/src/deviceio.c:408: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(data, device->buffer, remaining); data/fatsort-1.6.3.622/src/deviceio.c:412: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(data, device->buffer, device->sectorSize); data/fatsort-1.6.3.622/src/deviceio.c:485:7: [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(device->buffer+(device->currentOffset % device->sectorSize), data, remaining); data/fatsort-1.6.3.622/src/deviceio.c:489:7: [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(device->buffer+(device->currentOffset % device->sectorSize), data, device->sectorSize); data/fatsort-1.6.3.622/src/deviceio.c:511: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(device->buffer, data, remaining); data/fatsort-1.6.3.622/src/deviceio.c:519: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(device->buffer, data, device->sectorSize); data/fatsort-1.6.3.622/src/endianness.c:36: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 cvalue[2]; data/fatsort-1.6.3.622/src/endianness.c:55: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 cvalue[4]; data/fatsort-1.6.3.622/src/endianness.c:77: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 cvalue[8]; data/fatsort-1.6.3.622/src/entrylist.c:99:2: [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(tmp->sde, sde, DIR_ENTRY_SIZE); data/fatsort-1.6.3.622/src/entrylist.c:125:2: [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(new->lde, lde, DIR_ENTRY_SIZE); data/fatsort-1.6.3.622/src/entrylist.c:175: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 s1[MAX_PATH_LEN+1]; data/fatsort-1.6.3.622/src/entrylist.c:176: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 s2[MAX_PATH_LEN+1]; data/fatsort-1.6.3.622/src/entrylist.c:177: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 s1_col[MAX_PATH_LEN*2+1]; data/fatsort-1.6.3.622/src/entrylist.c:178: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 s2_col[MAX_PATH_LEN*2+1]; data/fatsort-1.6.3.622/src/entrylist.c:179: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 scase1[MAX_PATH_LEN+1]; data/fatsort-1.6.3.622/src/entrylist.c:180: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 scase2[MAX_PATH_LEN+1]; data/fatsort-1.6.3.622/src/entrylist.c:444:2: [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(&tmp->de, new, DIR_ENTRY_SIZE); data/fatsort-1.6.3.622/src/entrylist.c:592: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 s1[MAX_PATH_LEN+1]; data/fatsort-1.6.3.622/src/entrylist.c:593: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 s2[MAX_PATH_LEN+1]; data/fatsort-1.6.3.622/src/entrylist.c:594: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 s1_col[MAX_PATH_LEN*2+1]; data/fatsort-1.6.3.622/src/entrylist.c:595: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 s2_col[MAX_PATH_LEN*2+1]; data/fatsort-1.6.3.622/src/entrylist.c:596: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 scase1[MAX_PATH_LEN+1]; data/fatsort-1.6.3.622/src/entrylist.c:597: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 scase2[MAX_PATH_LEN+1]; data/fatsort-1.6.3.622/src/errors.c:33: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 msg[129]; data/fatsort-1.6.3.622/src/options.c:51:70: [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. int32_t addDirPathToStringList(struct sStringList *stringList, const char (*str)[MAX_PATH_LEN+1]) { data/fatsort-1.6.3.622/src/options.c:79:2: [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(newStr+prefix, (const char*) str, len); data/fatsort-1.6.3.622/src/options.c:102:11: [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 char (*str)[MAX_PATH_LEN+1]) { data/fatsort-1.6.3.622/src/options.c:325: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(OPT_LOCALE, optarg, len+1); data/fatsort-1.6.3.622/src/options.h:48:11: [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 char (*str)[MAX_PATH_LEN+1]); data/fatsort-1.6.3.622/src/regexlist.c:58: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 errbuf[128]; data/fatsort-1.6.3.622/src/sort.c:75: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 utf16str[28]; data/fatsort-1.6.3.622/src/sort.c:79:2: [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(utf16str, (&lde->LDIR_Ord+1), 10); data/fatsort-1.6.3.622/src/sort.c:80:2: [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(utf16str+10, (&lde->LDIR_Ord+14), 12); data/fatsort-1.6.3.622/src/sort.c:81:2: [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(utf16str+22, (&lde->LDIR_Ord+28), 4); data/fatsort-1.6.3.622/src/sort.c:293: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 name[MAX_PATH_LEN+1]; data/fatsort-1.6.3.622/src/sort.c:294: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 str[31]; data/fatsort-1.6.3.622/src/sort.c:543: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 tmp[MAX_PATH_LEN+1], dummy[MAX_PATH_LEN+1], sname[MAX_PATH_LEN+1], lname[MAX_PATH_LEN+1]; data/fatsort-1.6.3.622/src/sort.c:660: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 tmp[MAX_PATH_LEN+1], dummy[MAX_PATH_LEN+1], sname[MAX_PATH_LEN+1], lname[MAX_PATH_LEN+1]; data/fatsort-1.6.3.622/src/sort.c:817: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 empty[DIR_ENTRY_SIZE]={0}; data/fatsort-1.6.3.622/src/sort.c:923: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 empty[DIR_ENTRY_SIZE]={0}; data/fatsort-1.6.3.622/src/sort.c:1004:86: [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. int32_t sortSubdirectories(struct sFileSystem *fs, struct sDirEntryList *list, const char (*path)[MAX_PATH_LEN+1]) { data/fatsort-1.6.3.622/src/sort.c:1013: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 newpath[MAX_PATH_LEN+1]={0}; data/fatsort-1.6.3.622/src/sort.c:1048:99: [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. int32_t sortExFATSubdirectories(struct sFileSystem *fs, struct sExFATDirEntrySetList *desl, const char (*path)[MAX_PATH_LEN+1]) { data/fatsort-1.6.3.622/src/sort.c:1057: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 newpath[MAX_PATH_LEN+1]={0}; data/fatsort-1.6.3.622/src/sort.c:1119:74: [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. int32_t sortClusterChain(struct sFileSystem *fs, uint32_t cluster, const char (*path)[MAX_PATH_LEN+1]) { data/fatsort-1.6.3.622/src/sort.c:1227:116: [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. int32_t sortExFATClusterChain(struct sFileSystem *fs, uint32_t cluster, uint32_t len, uint16_t isContiguous, const char (*path)[MAX_PATH_LEN+1]) { data/fatsort-1.6.3.622/src/sort.c:1353:8: [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 char rootDir[2] = {DIRECTORY_SEPARATOR, '\0'}; data/fatsort-1.6.3.622/src/sort.c:1412:42: [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 (sortSubdirectories(fs, list, (const char (*)[MAX_PATH_LEN+1]) rootDir) == -1 ){ data/fatsort-1.6.3.622/src/sort.c:1434:8: [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 char rootDir[2] = {DIRECTORY_SEPARATOR, '\0'}; data/fatsort-1.6.3.622/src/sort.h:39:74: [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. int32_t sortClusterChain(struct sFileSystem *fs, uint32_t cluster, const char (*path)[MAX_PATH_LEN+1]); data/fatsort-1.6.3.622/src/sort.h:45:115: [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. int32_t sortExFATClusterChain(struct sFileSystem *fs, uint32_t cluster, uint32_t len, uint16_t isContigous, const char (*path)[MAX_PATH_LEN+1]); data/fatsort-1.6.3.622/src/stringlist.c:81:2: [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(stringList->next->str, str, len+1); data/fatsort-1.6.3.622/src/FAT_fs.c:1125:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(fs->path, path, MAX_PATH_LEN); data/fatsort-1.6.3.622/src/deviceio.c:103:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return read(device->fd, data, (size_t) size * n); data/fatsort-1.6.3.622/src/deviceio.c:235: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(path) == 2) && (path[1] == ':')) { data/fatsort-1.6.3.622/src/entrylist.c:78: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 ((tmp->sname=malloc(strlen(sname)+1))==NULL) { data/fatsort-1.6.3.622/src/entrylist.c: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). if ((tmp->lname=malloc(strlen(lname)+1))==NULL) { data/fatsort-1.6.3.622/src/entrylist.c:151:10: [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). len_old=strlen(old); data/fatsort-1.6.3.622/src/entrylist.c:154:7: [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). len=strlen(prefix->next->str); data/fatsort-1.6.3.622/src/entrylist.c:157:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(new, old+len, len_old-len); data/fatsort-1.6.3.622/src/entrylist.c:474:24: [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 ((new->name=malloc(strlen(name)+1))==NULL) { data/fatsort-1.6.3.622/src/mallocv.c:64:14: [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 flen=strlen(filename); data/fatsort-1.6.3.622/src/mallocv.c:71:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(list->next->file, filename, flen); data/fatsort-1.6.3.622/src/options.c:63:6: [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). len=strlen((char*)str); data/fatsort-1.6.3.622/src/options.c:188:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(OPT_LOCALE, WIN_LOCALE, strlen(WIN_LOCALE)); data/fatsort-1.6.3.622/src/options.c:188:34: [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). strncpy(OPT_LOCALE, WIN_LOCALE, strlen(WIN_LOCALE)); data/fatsort-1.6.3.622/src/options.c:319: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). len=strlen(optarg); data/fatsort-1.6.3.622/src/sort.c:142:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(str, sde->DIR_Name, 8); data/fatsort-1.6.3.622/src/sort.c:147:3: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(str, "."); data/fatsort-1.6.3.622/src/sort.c:148:3: [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(str, sde->DIR_Name+8, 3); data/fatsort-1.6.3.622/src/sort.c:407:6: [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(name, str, 31); data/fatsort-1.6.3.622/src/sort.c:620:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(dummy, tmp, MAX_PATH_LEN); data/fatsort-1.6.3.622/src/sort.c:622: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(dummy, lname, MAX_PATH_LEN - strlen(dummy)); data/fatsort-1.6.3.622/src/sort.c:622: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). strncat(dummy, lname, MAX_PATH_LEN - strlen(dummy)); data/fatsort-1.6.3.622/src/sort.c:624:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(lname, dummy, MAX_PATH_LEN+1); data/fatsort-1.6.3.622/src/sort.c:738:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(dummy, tmp, MAX_PATH_LEN); data/fatsort-1.6.3.622/src/sort.c:740:4: [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(dummy, lname, MAX_PATH_LEN - strlen(dummy)); data/fatsort-1.6.3.622/src/sort.c:740:41: [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(dummy, lname, MAX_PATH_LEN - strlen(dummy)); data/fatsort-1.6.3.622/src/sort.c:742:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(lname, dummy, MAX_PATH_LEN+1); data/fatsort-1.6.3.622/src/sort.c:1074:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(newpath, (char*) path, MAX_PATH_LEN - strlen(newpath)); data/fatsort-1.6.3.622/src/sort.c:1074:50: [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). strncpy(newpath, (char*) path, MAX_PATH_LEN - strlen(newpath)); data/fatsort-1.6.3.622/src/sort.c:1076:4: [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(newpath, p->des->name, MAX_PATH_LEN - strlen(newpath)); data/fatsort-1.6.3.622/src/sort.c:1076:50: [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(newpath, p->des->name, MAX_PATH_LEN - strlen(newpath)); data/fatsort-1.6.3.622/src/sort.c:1078:4: [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(newpath, "/", MAX_PATH_LEN - strlen(newpath)); data/fatsort-1.6.3.622/src/sort.c:1078:41: [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(newpath, "/", MAX_PATH_LEN - strlen(newpath)); data/fatsort-1.6.3.622/src/stringlist.c:72:6: [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). len=strlen(str); data/fatsort-1.6.3.622/src/stringlist.c:100:37: [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 (strncmp(stringList->str, str, strlen(stringList->str)) == 0) { ANALYSIS SUMMARY: Hits = 120 Lines analyzed = 6818 in approximately 0.73 seconds (9365 lines/second) Physical Source Lines of Code (SLOC) = 4285 Hits@level = [0] 53 [1] 35 [2] 72 [3] 6 [4] 7 [5] 0 Hits@level+ = [0+] 173 [1+] 120 [2+] 85 [3+] 13 [4+] 7 [5+] 0 Hits/KSLOC@level+ = [0+] 40.3734 [1+] 28.0047 [2+] 19.8366 [3+] 3.03384 [4+] 1.63361 [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.