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/htpdate-1.2.2/htpdate.c FINAL RESULTS: data/htpdate-1.2.2/htpdate.c:162:9: [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. (void) vsnprintf(buf, sizeof(buf), format, args); data/htpdate-1.2.2/htpdate.c:85:10: [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. tz = getenv("TZ"); data/htpdate-1.2.2/htpdate.c:543:19: [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 ( (param = getopt(argc, argv, "046abdhi:lm:p:qstu:xDM:P:") ) != -1) data/htpdate-1.2.2/htpdate.c:159: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[128]; data/htpdate-1.2.2/htpdate.c:196: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 buffer[BUFFERSIZE] = { '\0' }; data/htpdate-1.2.2/htpdate.c:197: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 remote_time[25] = { '\0' }; data/htpdate-1.2.2/htpdate.c:198: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 url[URLSIZE] = { '\0' }; data/htpdate-1.2.2/htpdate.c:452:13: [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). pid_file = fopen(pidfile, "r"); data/htpdate-1.2.2/htpdate.c:497:14: [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). pid_file = fopen( pidfile, "w" ); data/htpdate-1.2.2/htpdate.c:574:22: [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). if ( ( minsleep = atoi(optarg) ) <= 0 ) { data/htpdate-1.2.2/htpdate.c:581: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). precision = atoi(optarg) ; data/htpdate-1.2.2/htpdate.c:627:22: [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). if ( ( maxsleep = atoi(optarg) ) <= 0 ) { data/htpdate-1.2.2/htpdate.c:703:15: [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. hostport = (char *)argv[i]; data/htpdate-1.2.2/htpdate.c:280:30: [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 ( send(server_s, buffer, strlen(buffer), 0) < 0 ) data/htpdate-1.2.2/htpdate.c:307:54: [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 ( (pdate = strstr(buffer, "Date: ")) != NULL && strlen( pdate ) >= 35 ) { data/htpdate-1.2.2/htpdate.c:308:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(remote_time, pdate + 11, 24); data/htpdate-1.2.2/htpdate.c:480:2: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(0); ANALYSIS SUMMARY: Hits = 17 Lines analyzed = 855 in approximately 0.06 seconds (14493 lines/second) Physical Source Lines of Code (SLOC) = 545 Hits@level = [0] 8 [1] 4 [2] 10 [3] 2 [4] 1 [5] 0 Hits@level+ = [0+] 25 [1+] 17 [2+] 13 [3+] 3 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 45.8716 [1+] 31.1927 [2+] 23.8532 [3+] 5.50459 [4+] 1.83486 [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.