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/statserial-1.1/statserial.c FINAL RESULTS: data/statserial-1.1/statserial.c:94: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(device, argv[optind]); /* one argument */ data/statserial-1.1/statserial.c:113: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(device, getenv("MODEM")); data/statserial-1.1/statserial.c:115: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(device, defaultDevice); data/statserial-1.1/statserial.c:124:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(s, "statserial: can't open device `%s'", device); data/statserial-1.1/statserial.c:67: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(argc, argv, flags)) != EOF) { data/statserial-1.1/statserial.c:112:7: [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. if (getenv("MODEM")) data/statserial-1.1/statserial.c:113:20: [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. strcpy(device, getenv("MODEM")); data/statserial-1.1/statserial.c:44: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 device[127]; /* name of device to open */ data/statserial-1.1/statserial.c:121:8: [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 | O_NOCTTY); data/statserial-1.1/statserial.c:123: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 s[255]; ANALYSIS SUMMARY: Hits = 10 Lines analyzed = 211 in approximately 0.02 seconds (9627 lines/second) Physical Source Lines of Code (SLOC) = 137 Hits@level = [0] 22 [1] 0 [2] 3 [3] 3 [4] 4 [5] 0 Hits@level+ = [0+] 32 [1+] 10 [2+] 10 [3+] 7 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 233.577 [1+] 72.9927 [2+] 72.9927 [3+] 51.0949 [4+] 29.1971 [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.