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/adjtimex-1.29/mat.h Examining data/adjtimex-1.29/mat.c Examining data/adjtimex-1.29/adjtimex.c FINAL RESULTS: data/adjtimex-1.29/adjtimex.c:1427:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(command, "%s -q -d %.32s ", paths[i], timeserver); data/adjtimex-1.29/adjtimex.c:1428:15: [4] (shell) popen: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. ifile = popen(command, "r"); data/adjtimex-1.29/adjtimex.c:2000:4: [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(startstring, ctime(&start)); data/adjtimex-1.29/adjtimex.c:2002:4: [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(finishstring, ctime(&finish)); data/adjtimex-1.29/adjtimex.c:2034:4: [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(startstring, ctime(&start)); data/adjtimex-1.29/adjtimex.c:2036:4: [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(finishstring, ctime(&finish)); data/adjtimex-1.29/adjtimex.c:2069:4: [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(startstring, ctime(&start)); data/adjtimex-1.29/adjtimex.c:2071:4: [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(finishstring, ctime(&finish)); data/adjtimex-1.29/adjtimex.c:330: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). count = atoi(optarg); data/adjtimex-1.29/adjtimex.c:335: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). count = atoi(optarg); data/adjtimex-1.29/adjtimex.c:367:17: [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). interval = atoi (optarg); data/adjtimex-1.29/adjtimex.c:378: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). txc.offset = atol(optarg); data/adjtimex-1.29/adjtimex.c:382: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). txc.offset = atol(optarg); data/adjtimex-1.29/adjtimex.c:386: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). txc.status = atol(optarg); data/adjtimex-1.29/adjtimex.c:391:17: [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). txc.freq = atol(optarg); data/adjtimex-1.29/adjtimex.c:395:21: [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). txc.maxerror = atol(optarg); data/adjtimex-1.29/adjtimex.c:399:21: [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). txc.esterror = atol(optarg); data/adjtimex-1.29/adjtimex.c:403:21: [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). txc.constant = atol(optarg); data/adjtimex-1.29/adjtimex.c:407:17: [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). txc.tick = atol(optarg); data/adjtimex-1.29/adjtimex.c:604: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). cmos_fd = open (cmos_device, O_RDONLY); data/adjtimex-1.29/adjtimex.c:657:15: [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). port_fd = open ("/dev/port", O_RDWR); data/adjtimex-1.29/adjtimex.c:809:7: [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[BUFLEN]; data/adjtimex-1.29/adjtimex.c:880:8: [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[BUFLEN]; data/adjtimex-1.29/adjtimex.c:1078:7: [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[BUFLEN]; data/adjtimex-1.29/adjtimex.c:1347: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 ch __attribute__ ((unused)), buf[64], *s; data/adjtimex-1.29/adjtimex.c:1409:7: [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 command[BUFLEN]; data/adjtimex-1.29/adjtimex.c:1410:7: [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[BUFLEN]; data/adjtimex-1.29/adjtimex.c:1491:7: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(sa.sa_data, he.h_addr_list[0], len); data/adjtimex-1.29/adjtimex.c:1563: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 buf[BUFLEN]; data/adjtimex-1.29/adjtimex.c:1684: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 buf[BUFLEN]; data/adjtimex-1.29/adjtimex.c:1729: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). if ((adj = fopen (ADJPATH, "r")) != NULL) data/adjtimex-1.29/adjtimex.c:1755:11: [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). lfile = fopen(log_path, "r"); data/adjtimex-1.29/adjtimex.c:1758:15: [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). lfile = fopen(log_path, "a+"); /* create it if it doesn't exist */ data/adjtimex-1.29/adjtimex.c:1782: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 buf[256], sys_flag, cmos_flag, junk[26]; data/adjtimex-1.29/adjtimex.c:1817: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 timestring[32]; data/adjtimex-1.29/adjtimex.c:1848:15: [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). lfile = fopen(log_path, "a+"); data/adjtimex-1.29/adjtimex.c:1942: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 startstring[26], finishstring[26]; data/adjtimex-1.29/adjtimex.c:566:43: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (lseek (port_fd, port, 0) == port && read (port_fd, &ret, 1)); data/adjtimex-1.29/adjtimex.c:803:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rc = read(cmos_fd, &interrupt_info, sizeof(interrupt_info)); data/adjtimex-1.29/adjtimex.c:1361:7: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ch = getchar(); data/adjtimex-1.29/adjtimex.c:1441:40: [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 (!strncmp(buf, "filter offset:", strlen("filter offset:"))) data/adjtimex-1.29/adjtimex.c:1792:16: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. tokens = sscanf(buf, "%25s %25s %lf %lf %lf %d %d %c %lf %c", ANALYSIS SUMMARY: Hits = 42 Lines analyzed = 2619 in approximately 0.10 seconds (26653 lines/second) Physical Source Lines of Code (SLOC) = 2027 Hits@level = [0] 117 [1] 5 [2] 29 [3] 0 [4] 8 [5] 0 Hits@level+ = [0+] 159 [1+] 42 [2+] 37 [3+] 8 [4+] 8 [5+] 0 Hits/KSLOC@level+ = [0+] 78.441 [1+] 20.7203 [2+] 18.2536 [3+] 3.94672 [4+] 3.94672 [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.