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/libgnatcoll-19/src/executable_path.c Examining data/libgnatcoll-19/src/objlist_file.c Examining data/libgnatcoll-19/src/link_max.c Examining data/libgnatcoll-19/src/separate_run_path_option.c Examining data/libgnatcoll-19/src/gnatcoll_support.c Examining data/libgnatcoll-19/src/update_path.c Examining data/libgnatcoll-19/src/run_path_option.c Examining data/libgnatcoll-19/src/getRSS.c Examining data/libgnatcoll-19/src/set_std_prefix.c Examining data/libgnatcoll-19/src/terminals.c FINAL RESULTS: data/libgnatcoll-19/src/executable_path.c:59:12: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. return readlink("/proc/self/exe", buffer, (size_t) size); data/libgnatcoll-19/src/gnatcoll_support.c:135:9: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod (file, statbuf.st_mode | S_IREAD); data/libgnatcoll-19/src/gnatcoll_support.c:137:9: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod (file, statbuf.st_mode & (~S_IREAD)); data/libgnatcoll-19/src/gnatcoll_support.c:172:12: [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. result = getenv ("TMPDIR"); data/libgnatcoll-19/src/gnatcoll_support.c:177:12: [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. result = getenv ("TMP"); data/libgnatcoll-19/src/gnatcoll_support.c:184:12: [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. result = getenv ("TEMP"); data/libgnatcoll-19/src/getRSS.c:57:13: [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). if ( (fd = open( "/proc/self/psinfo", O_RDONLY )) == -1 ) data/libgnatcoll-19/src/getRSS.c:112: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). if ( (fp = fopen( "/proc/self/statm", "r" )) == NULL ) data/libgnatcoll-19/src/executable_path.c:38: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). return strlen(buffer); data/libgnatcoll-19/src/getRSS.c:59:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ( read( fd, &psinfo, sizeof(psinfo) ) != sizeof(psinfo) ) ANALYSIS SUMMARY: Hits = 10 Lines analyzed = 702 in approximately 0.28 seconds (2512 lines/second) Physical Source Lines of Code (SLOC) = 346 Hits@level = [0] 2 [1] 2 [2] 2 [3] 3 [4] 0 [5] 3 Hits@level+ = [0+] 12 [1+] 10 [2+] 8 [3+] 6 [4+] 3 [5+] 3 Hits/KSLOC@level+ = [0+] 34.6821 [1+] 28.9017 [2+] 23.1214 [3+] 17.341 [4+] 8.67052 [5+] 8.67052 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.