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/amiga-fdisk-0.04/include/amigastuff.h Examining data/amiga-fdisk-0.04/include/amiga/filehandler.h Examining data/amiga-fdisk-0.04/include/amiga/hardblocks.h Examining data/amiga-fdisk-0.04/include/amiga/types.h Examining data/amiga-fdisk-0.04/include/fdisk.h Examining data/amiga-fdisk-0.04/include/implemented.h Examining data/amiga-fdisk-0.04/fdisk.c Examining data/amiga-fdisk-0.04/amigastuff.c FINAL RESULTS: data/amiga-fdisk-0.04/fdisk.c:41:12: [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). s = strcpy (s, buffer); data/amiga-fdisk-0.04/fdisk.c:229: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(disk_device, optarg); data/amiga-fdisk-0.04/fdisk.c:269: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(disk_device, testdevs[count++]); data/amiga-fdisk-0.04/fdisk.c:225: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. while(((c = getopt(argc, argv, "-dvls:TViN:A:u:xC:H:S:fqLnRO:I:?")) != EOF)) data/amiga-fdisk-0.04/amigastuff.c:65:1: [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 type[100]; /* Needed by DosType() */ data/amiga-fdisk-0.04/amigastuff.c:83: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). if ((l=open(disk_device,O_RDONLY))<0) { data/amiga-fdisk-0.04/amigastuff.c:324:9: [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 ((f=open(disk_device,O_RDONLY))<0) { data/amiga-fdisk-0.04/amigastuff.c:507: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(pa[nr]->pb_DriveName,"\003dhx",4); data/amiga-fdisk-0.04/amigastuff.c:682:9: [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 ((f=open(disk_device,O_RDONLY))<0) { data/amiga-fdisk-0.04/amigastuff.c:814: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 (newblks+i*SECTOR_SIZE,initsectors+i*SECTOR_SIZE,SECTOR_SIZE); data/amiga-fdisk-0.04/amigastuff.c:820: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 (newblks+i*SECTOR_SIZE,rdb,SECTOR_SIZE); data/amiga-fdisk-0.04/amigastuff.c:830:3: [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 (curr,initsectors+block*SECTOR_SIZE,SECTOR_SIZE); data/amiga-fdisk-0.04/amigastuff.c:843:3: [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 (curr,initsectors+(block*SECTOR_SIZE),SECTOR_SIZE); data/amiga-fdisk-0.04/amigastuff.c:856:3: [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 (curr,initsectors+block*SECTOR_SIZE,SECTOR_SIZE); data/amiga-fdisk-0.04/amigastuff.c:868: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 (curr,initsectors+blk2*SECTOR_SIZE,SECTOR_SIZE); data/amiga-fdisk-0.04/amigastuff.c:887:3: [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 (curr,initsectors+block*SECTOR_SIZE,SECTOR_SIZE); data/amiga-fdisk-0.04/amigastuff.c:918:9: [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 ((f=open(disk_device,O_WRONLY))<0) { data/amiga-fdisk-0.04/amigastuff.c:950: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 dchar[4]; data/amiga-fdisk-0.04/amigastuff.c:956:7: [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. j = sprintf(type, "0x%04x = ",(unsigned int) dostype); data/amiga-fdisk-0.04/amigastuff.c:962:10: [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. j += sprintf(type + j, "\\%o", dt.dchar[i]); data/amiga-fdisk-0.04/amigastuff.c:970:24: [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. case 0x444f5300: j += sprintf(type + j, "Amiga OFS");break; data/amiga-fdisk-0.04/amigastuff.c:971:24: [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. case 0x444f5301: j += sprintf(type + j, "Amiga FFS");break; data/amiga-fdisk-0.04/amigastuff.c:972:24: [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. case 0x444f5302: j += sprintf(type + j, "Amiga OFS Int.");break; data/amiga-fdisk-0.04/amigastuff.c:973:24: [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. case 0x444f5303: j += sprintf(type + j, "Amiga FFS Int.");break; data/amiga-fdisk-0.04/amigastuff.c:974:24: [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. case 0x444f5304: j += sprintf(type + j, "Amiga OFS DirCache");break; data/amiga-fdisk-0.04/amigastuff.c:975:24: [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. case 0x444f5305: j += sprintf(type + j, "Amiga FFS DirCache");break; data/amiga-fdisk-0.04/amigastuff.c:976:24: [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. case 0x4C4E5800: j += sprintf(type + j, "Linux native");break; data/amiga-fdisk-0.04/amigastuff.c:977:24: [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. case 0x53575000: j += sprintf(type + j, "Linux swap");break; data/amiga-fdisk-0.04/amigastuff.c:978: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. default: j += sprintf(type + j, "[unknown]");break; data/amiga-fdisk-0.04/fdisk.c:33: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. char buffer[1024]; data/amiga-fdisk-0.04/fdisk.c:68:1: [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 disk_device[256]="/dev/sda"; data/amiga-fdisk-0.04/fdisk.c:75:16: [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). return atoi(s); data/amiga-fdisk-0.04/include/amiga/hardblocks.h:37: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 rdb_DiskVendor[8]; data/amiga-fdisk-0.04/include/amiga/hardblocks.h:38: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 rdb_DiskProduct[16]; data/amiga-fdisk-0.04/include/amiga/hardblocks.h:39: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 rdb_DiskRevision[4]; data/amiga-fdisk-0.04/include/amiga/hardblocks.h:40: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 rdb_ControllerVendor[8]; data/amiga-fdisk-0.04/include/amiga/hardblocks.h:41: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 rdb_ControllerProduct[16]; data/amiga-fdisk-0.04/include/amiga/hardblocks.h:42: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 rdb_ControllerRevision[4]; data/amiga-fdisk-0.04/include/fdisk.h:23: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. extern char disk_device[256]; data/amiga-fdisk-0.04/amigastuff.c:95:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(l,listsector,SECTOR_SIZE)!=SECTOR_SIZE) { data/amiga-fdisk-0.04/amigastuff.c:342:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(f,(char *)rdb,SECTOR_SIZE)!=SECTOR_SIZE) { data/amiga-fdisk-0.04/amigastuff.c:386:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(f,initsectors,i*SECTOR_SIZE)!=i*SECTOR_SIZE) { data/amiga-fdisk-0.04/amigastuff.c:964:8: [1] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source is a constant character. j += sprintf(type + j, " "); data/amiga-fdisk-0.04/fdisk.c:39: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). size = strlen (buffer); ANALYSIS SUMMARY: Hits = 44 Lines analyzed = 1778 in approximately 0.07 seconds (26843 lines/second) Physical Source Lines of Code (SLOC) = 1292 Hits@level = [0] 84 [1] 5 [2] 35 [3] 1 [4] 3 [5] 0 Hits@level+ = [0+] 128 [1+] 44 [2+] 39 [3+] 4 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 99.0712 [1+] 34.0557 [2+] 30.1858 [3+] 3.09598 [4+] 2.32198 [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.