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/tty-clock-2.3/ttyclock.c Examining data/tty-clock-2.3/ttyclock.h FINAL RESULTS: data/tty-clock-2.3/ttyclock.c:215:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(ttyclock->date.datestr, "%s%s", tmpstr, ttyclock->meridiem); data/tty-clock-2.3/ttyclock.c:565:18: [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, "iuvsScbtrhBxnDC:f:d:T:a:")) != -1) data/tty-clock-2.3/ttyclock.c:43:20: [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). FILE *ftty = fopen(ttyclock->tty, "r+"); data/tty-clock-2.3/ttyclock.c:183: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 tmpstr[128]; data/tty-clock-2.3/ttyclock.c:617: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). if(atoi(optarg) >= 0 && atoi(optarg) < 8) data/tty-clock-2.3/ttyclock.c:617:40: [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(atoi(optarg) >= 0 && atoi(optarg) < 8) data/tty-clock-2.3/ttyclock.c:618:46: [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). ttyclock->option.color = atoi(optarg); data/tty-clock-2.3/ttyclock.c:630:19: [2] (integer) atol: 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(atol(optarg) >= 0 && atol(optarg) < 100) data/tty-clock-2.3/ttyclock.c:630:40: [2] (integer) atol: 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(atol(optarg) >= 0 && atol(optarg) < 100) data/tty-clock-2.3/ttyclock.c:631:46: [2] (integer) atol: 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). ttyclock->option.delay = atol(optarg); data/tty-clock-2.3/ttyclock.c:640:19: [2] (integer) atol: 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(atol(optarg) >= 0 && atol(optarg) < 1000000000) data/tty-clock-2.3/ttyclock.c:640:40: [2] (integer) atol: 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(atol(optarg) >= 0 && atol(optarg) < 1000000000) data/tty-clock-2.3/ttyclock.c:641:48: [2] (integer) atol: 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). ttyclock->option.nsdelay = atol(optarg); data/tty-clock-2.3/ttyclock.h:102:11: [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 datestr[256]; data/tty-clock-2.3/ttyclock.c:117:43: [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). ttyclock->datewin = newwin(DATEWINH, strlen(ttyclock->date.datestr) + 2, data/tty-clock-2.3/ttyclock.c:120:34: [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). (strlen(ttyclock->date.datestr) / 2) - 1); data/tty-clock-2.3/ttyclock.c:325:60: [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). ttyclock->geo.y + (ttyclock->geo.w / 2) - (strlen(ttyclock->date.datestr) / 2) - 1); data/tty-clock-2.3/ttyclock.c:326:48: [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). wresize(ttyclock->datewin, DATEWINH, strlen(ttyclock->date.datestr) + 2); data/tty-clock-2.3/ttyclock.c:555:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy(ttyclock->option.format, "%F", 100); data/tty-clock-2.3/ttyclock.c:627:16: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ttyclock->option.format, optarg, 100); ANALYSIS SUMMARY: Hits = 20 Lines analyzed = 827 in approximately 0.05 seconds (16529 lines/second) Physical Source Lines of Code (SLOC) = 609 Hits@level = [0] 5 [1] 6 [2] 12 [3] 1 [4] 1 [5] 0 Hits@level+ = [0+] 25 [1+] 20 [2+] 14 [3+] 2 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 41.0509 [1+] 32.8407 [2+] 22.9885 [3+] 3.28407 [4+] 1.64204 [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.