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/gap-io-4.7.0+ds/src/io.c FINAL RESULTS: data/gap-io-4.7.0+ds/src/io.c:671:13: [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. res = readlink(CSTR_STRING(path), data/gap-io-4.7.0+ds/src/io.c:835:13: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. res = chmod(CSTR_STRING(pathname),INT_INTOBJ(mode)); data/gap-io-4.7.0+ds/src/io.c:872:13: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. res = chown(CSTR_STRING(path), data/gap-io-4.7.0+ds/src/io.c:1558:9: [4] (shell) execv: 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. i = execv(CSTR_STRING(path),argv); data/gap-io-4.7.0+ds/src/io.c:1593:9: [4] (shell) execvp: 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. i = execvp(CSTR_STRING(file),argv); data/gap-io-4.7.0+ds/src/io.c:363: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). res = open(CSTR_STRING(path), data/gap-io-4.7.0+ds/src/io.c:704: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[GAP_PATH_MAX]; data/gap-io-4.7.0+ds/src/io.c:949:14: [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(CSTR_STRING(template)); data/gap-io-4.7.0+ds/src/io.c:1126: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.sin_addr.s_addr),CHARS_STRING(ip),4); data/gap-io-4.7.0+ds/src/io.c:1128: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(CHARS_STRING(res),&sa,sizeof(sa)); data/gap-io-4.7.0+ds/src/io.c:1172:11: [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(CHARS_STRING(tmp), *p, he->h_length); data/gap-io-4.7.0+ds/src/io.c:1535:5: [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 *argv[1024]; /* Up to 1024 arguments */ data/gap-io-4.7.0+ds/src/io.c:1570:5: [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 *argv[1024]; /* Up to 1024 arguments */ data/gap-io-4.7.0+ds/src/io.c:1605:5: [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 *argv[1024]; /* Up to 1024 arguments */ data/gap-io-4.7.0+ds/src/io.c:1606:5: [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 *envp[1024]; /* Up to 1024 environment entries */ data/gap-io-4.7.0+ds/src/io.c:1832: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(CHARS_STRING(res),&sa,sa_len); data/gap-io-4.7.0+ds/src/io.c:1841: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 name[256]; data/gap-io-4.7.0+ds/src/io.c:1850: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(CHARS_STRING(res),name,i); data/gap-io-4.7.0+ds/src/io.c:402:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bytes = read(INT_INTOBJ(fd),CHARS_STRING(st)+INT_INTOBJ(offset), data/gap-io-4.7.0+ds/src/io.c:1848:7: [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). i = strlen(name); ANALYSIS SUMMARY: Hits = 20 Lines analyzed = 3020 in approximately 0.10 seconds (30322 lines/second) Physical Source Lines of Code (SLOC) = 2685 Hits@level = [0] 2 [1] 2 [2] 13 [3] 0 [4] 2 [5] 3 Hits@level+ = [0+] 22 [1+] 20 [2+] 18 [3+] 5 [4+] 5 [5+] 3 Hits/KSLOC@level+ = [0+] 8.19367 [1+] 7.44879 [2+] 6.70391 [3+] 1.8622 [4+] 1.8622 [5+] 1.11732 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.