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/fmtools-2.0.7/fmlib.h Examining data/fmtools-2.0.7/fmscan.c Examining data/fmtools-2.0.7/fmlib.c Examining data/fmtools-2.0.7/fm.c FINAL RESULTS: data/fmtools-2.0.7/fm.c:128:17: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(buffer, format, int_time); data/fmtools-2.0.7/fm.c:201:4: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. sscanf(buf, "%*s %s", wait_time); data/fmtools-2.0.7/fmlib.c:52:9: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, msg, args); data/fmtools-2.0.7/fmlib.h:37:41: [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. __attribute__((noreturn, format(printf, 2, 3))); data/fmtools-2.0.7/fm.c:186:55: [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. snprintf(buf, sizeof buf, "%s/.fmrc", getenv("HOME")); data/fmtools-2.0.7/fm.c:245:30: [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. int option = getopt(argc, argv, "+qhot:T:c:d:"); data/fmtools-2.0.7/fmscan.c:75:30: [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. int option = getopt(argc, argv, "+e:hi:s:od:T:t:q"); data/fmtools-2.0.7/fm.c:47:13: [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). atoi(string) < 0) data/fmtools-2.0.7/fm.c:54: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 worktime[80+1]; data/fmtools-2.0.7/fm.c:62:13: [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). inttime = atoi(worktime); data/fmtools-2.0.7/fm.c:93:13: [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). atoi(string) < 0) data/fmtools-2.0.7/fm.c:94:17: [2] (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). Risk is low because the source is a constant string. strcpy(buffer, "forever"); data/fmtools-2.0.7/fm.c:97:17: [2] (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). Risk is low because the source is a constant string. strcpy(buffer, "none"); data/fmtools-2.0.7/fm.c:100: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. char worktime[80+1]; data/fmtools-2.0.7/fm.c:108:28: [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). int_time = atoi(worktime); data/fmtools-2.0.7/fm.c:137: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 message[80+1]; data/fmtools-2.0.7/fm.c:183: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 buf[256]; data/fmtools-2.0.7/fm.c:189:9: [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). conf = fopen(fn, "r"); data/fmtools-2.0.7/fm.c:233: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 wait_time_buf[256+1] = ""; data/fmtools-2.0.7/fm.c:257:33: [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). index = atoi(optarg); data/fmtools-2.0.7/fmlib.c:97: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). tuner->fd = open(device, O_RDONLY); data/fmtools-2.0.7/fmscan.c:84:33: [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). index = atoi(optarg); data/fmtools-2.0.7/fm.c:60:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(worktime, string, suffix - string); data/fmtools-2.0.7/fm.c:106:17: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(worktime, string, suffix - string); data/fmtools-2.0.7/fm.c:195: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). buf[strlen(buf)-1] = 0; data/fmtools-2.0.7/fmlib.c:217:17: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(usecs); ANALYSIS SUMMARY: Hits = 26 Lines analyzed = 879 in approximately 0.06 seconds (14679 lines/second) Physical Source Lines of Code (SLOC) = 687 Hits@level = [0] 48 [1] 4 [2] 15 [3] 3 [4] 4 [5] 0 Hits@level+ = [0+] 74 [1+] 26 [2+] 22 [3+] 7 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 107.715 [1+] 37.8457 [2+] 32.0233 [3+] 10.1892 [4+] 5.82242 [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.