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/envstore-2.1/src/envstore.c FINAL RESULTS: data/envstore-2.1/src/envstore.c:107:23: [4] (buffer) fscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. while ((read_items = fscanf(fp, SCAN_FORMAT, vname, vcontent)) != EOF) { data/envstore-2.1/src/envstore.c:132:10: [4] (buffer) fscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. while (fscanf(old_fp, SCAN_FORMAT, curparam, curvalue) != EOF) { data/envstore-2.1/src/envstore.c:145:15: [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. newvalue = getenv(param); data/envstore-2.1/src/envstore.c:209:15: [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. store_file = getenv("ENVSTORE_FILE"); data/envstore-2.1/src/envstore.c:28: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). FILE *fp = fopen(file, "r"); data/envstore-2.1/src/envstore.c:65:7: [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). fp = fopen(file, "w"); data/envstore-2.1/src/envstore.c:99:2: [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 vname[PARAM_LENGTH]; data/envstore-2.1/src/envstore.c:100:2: [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 vcontent[VALUE_LENGTH]; data/envstore-2.1/src/envstore.c:124:2: [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 curparam[PARAM_LENGTH]; data/envstore-2.1/src/envstore.c:125:2: [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 curvalue[VALUE_LENGTH]; data/envstore-2.1/src/envstore.c:50: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). char *new_file = malloc(strlen(file) + 5); data/envstore-2.1/src/envstore.c:55:25: [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 (snprintf(new_file, strlen(file) + 5, "%s.tmp", file) < 3) data/envstore-2.1/src/envstore.c:64:2: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(0077); data/envstore-2.1/src/envstore.c:87:18: [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). for (i = 0; i < strlen(content); i++) { data/envstore-2.1/src/envstore.c:150:8: [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 ((strlen(param) > PARAM_LENGTH - 1) || (strlen(newvalue) > VALUE_LENGTH - 1)) data/envstore-2.1/src/envstore.c:150:46: [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 ((strlen(param) > PARAM_LENGTH - 1) || (strlen(newvalue) > VALUE_LENGTH - 1)) ANALYSIS SUMMARY: Hits = 16 Lines analyzed = 252 in approximately 0.02 seconds (10614 lines/second) Physical Source Lines of Code (SLOC) = 182 Hits@level = [0] 6 [1] 6 [2] 6 [3] 2 [4] 2 [5] 0 Hits@level+ = [0+] 22 [1+] 16 [2+] 10 [3+] 4 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 120.879 [1+] 87.9121 [2+] 54.9451 [3+] 21.978 [4+] 10.989 [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.