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/setcd-1.5/setcd.c FINAL RESULTS: data/setcd-1.5/setcd.c:194:15: [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(ac, av, "c:d:e:f:hil:o:rst:x:"))!=EOF) { data/setcd-1.5/setcd.c:103:6: [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 buf[ISOFS_BLOCK_SIZE]; data/setcd-1.5/setcd.c:196:25: [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). case 'c': auto_close=atoi(optarg); break; data/setcd-1.5/setcd.c:197:19: [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). case 'd': disc=atoi(optarg); break; data/setcd-1.5/setcd.c:198:21: [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). case 'f': fflags=atoi(optarg); break; data/setcd-1.5/setcd.c:199:35: [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). case 'e': auto_close=auto_open=atoi(optarg); break; data/setcd-1.5/setcd.c:201:19: [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). case 'l': lock=atoi(optarg); break; data/setcd-1.5/setcd.c:202:24: [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). case 'o': auto_open=atoi(optarg); break; data/setcd-1.5/setcd.c:205:24: [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). case 't': typecheck=atoi(optarg); break; data/setcd-1.5/setcd.c:206:20: [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). case 'x': speed=atoi(optarg); break; data/setcd-1.5/setcd.c:220: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). fd = open(device, O_RDONLY | O_NONBLOCK); data/setcd-1.5/setcd.c:256: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 buffer[28]; data/setcd-1.5/setcd.c:107:4: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(fd, buf, ISOFS_BLOCK_SIZE); ANALYSIS SUMMARY: Hits = 13 Lines analyzed = 324 in approximately 0.02 seconds (16087 lines/second) Physical Source Lines of Code (SLOC) = 277 Hits@level = [0] 26 [1] 1 [2] 11 [3] 1 [4] 0 [5] 0 Hits@level+ = [0+] 39 [1+] 13 [2+] 12 [3+] 1 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 140.794 [1+] 46.9314 [2+] 43.3213 [3+] 3.61011 [4+] 0 [5+] 0 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.