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/ioping-1.2/ioping.c FINAL RESULTS: data/ioping-1.2/ioping.c:151:2: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, ERR_PREFIX); data/ioping-1.2/ioping.c:152:2: [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, fmt, ap); data/ioping-1.2/ioping.c:162:2: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, ERR_PREFIX); data/ioping-1.2/ioping.c:163:2: [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, fmt, ap); data/ioping-1.2/ioping.c:173:2: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, ERR_PREFIX); data/ioping-1.2/ioping.c:174:2: [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, fmt, ap); data/ioping-1.2/ioping.c:1024:4: [4] (tmpfile) mktemp: Temporary file race condition (CWE-377). mktemp(file_path); data/ioping-1.2/ioping.c:294:6: [3] (random) srandom: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. void srandom(unsigned int seed) data/ioping-1.2/ioping.c:296:2: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand(seed); data/ioping-1.2/ioping.c:299:10: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. long int random(void) data/ioping-1.2/ioping.c:632:3: [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. getopt(argc, argv, options) data/ioping-1.2/ioping.c:790:9: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. real = realpath(device, NULL); data/ioping-1.2/ioping.c:1166:2: [3] (random) srandom: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srandom(now()); data/ioping-1.2/ioping.c:1167:20: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. random_state[0] = random(); data/ioping-1.2/ioping.c:1168:20: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. random_state[1] = random(); data/ioping-1.2/ioping.c:235:7: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). fd = mkstemp(template); data/ioping-1.2/ioping.c:239:9: [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). return open(template, O_RDWR | flags); data/ioping-1.2/ioping.c:760: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). file = fopen("/proc/self/mountinfo", "r"); data/ioping-1.2/ioping.c:774: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). file = fopen("/proc/mounts", "r"); data/ioping-1.2/ioping.c:1023:4: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(file_path, ".XXXXXX"); data/ioping-1.2/ioping.c:1088: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(path, (write_test ? O_RDWR : O_RDONLY) | flags); data/ioping-1.2/ioping.c:1101: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(file_path, O_RDWR | O_CREAT | flags, 0600); data/ioping-1.2/ioping.c:1108:7: [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(path, O_RDWR | O_TMPFILE | flags, 0600); data/ioping-1.2/ioping.c:1113:2: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(file_path, ".XXXXXX"); data/ioping-1.2/ioping.c:1183:3: [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(ptr, &last, len & 7); data/ioping-1.2/ioping.c:1014:16: [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). int length = strlen(path) + strlen(temp) + 9; data/ioping-1.2/ioping.c:1014:31: [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). int length = strlen(path) + strlen(temp) + 9; data/ioping-1.2/ioping.c:1094:11: [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). length = strlen(path) + strlen(temp) + 9; data/ioping-1.2/ioping.c:1094:26: [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). length = strlen(path) + strlen(temp) + 9; ANALYSIS SUMMARY: Hits = 29 Lines analyzed = 1742 in approximately 0.06 seconds (30548 lines/second) Physical Source Lines of Code (SLOC) = 1438 Hits@level = [0] 43 [1] 4 [2] 10 [3] 8 [4] 7 [5] 0 Hits@level+ = [0+] 72 [1+] 29 [2+] 25 [3+] 15 [4+] 7 [5+] 0 Hits/KSLOC@level+ = [0+] 50.0695 [1+] 20.1669 [2+] 17.3853 [3+] 10.4312 [4+] 4.86787 [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.