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/gfsecret-0.4.6/lib/splitstr.h Examining data/gfsecret-0.4.6/lib/err.compat.h Examining data/gfsecret-0.4.6/lib/progname.c Examining data/gfsecret-0.4.6/lib/compat.h Examining data/gfsecret-0.4.6/lib/strchrnul.c Examining data/gfsecret-0.4.6/lib/xmem.c Examining data/gfsecret-0.4.6/lib/splitstr.c Examining data/gfsecret-0.4.6/lib/xmem.h Examining data/gfsecret-0.4.6/lib/err.c Examining data/gfsecret-0.4.6/src/secretcfg.c Examining data/gfsecret-0.4.6/src/scheme-libmtp.c Examining data/gfsecret-0.4.6/src/secretcfg.h Examining data/gfsecret-0.4.6/src/scheme-module.c Examining data/gfsecret-0.4.6/src/secret.c Examining data/gfsecret-0.4.6/src/gfsec-use.c Examining data/gfsecret-0.4.6/src/scheme-file.c Examining data/gfsecret-0.4.6/src/util.c Examining data/gfsecret-0.4.6/src/scheme-file.h Examining data/gfsecret-0.4.6/src/schemes.h Examining data/gfsecret-0.4.6/src/secret.h Examining data/gfsecret-0.4.6/src/gfsec-errors.h Examining data/gfsecret-0.4.6/src/scheme-libmtp.h Examining data/gfsecret-0.4.6/src/gfsec-split.c Examining data/gfsecret-0.4.6/src/support.h Examining data/gfsecret-0.4.6/src/support.c Examining data/gfsecret-0.4.6/src/util.h Examining data/gfsecret-0.4.6/src/scheme-module.h Examining data/gfsecret-0.4.6/src/scheme-gio.h Examining data/gfsecret-0.4.6/src/scheme-gio.c FINAL RESULTS: data/gfsecret-0.4.6/lib/err.c:39:9: [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/gfsecret-0.4.6/lib/xmem.c:82:5: [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(dup, s); data/gfsecret-0.4.6/lib/xmem.c:121:9: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. n = vsnprintf(NULL, 0, fmt, aq) + 1; data/gfsecret-0.4.6/lib/xmem.c:127:9: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. n = vsnprintf(*s, n, fmt, ap); data/gfsecret-0.4.6/src/gfsec-split.c:378:13: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(fmt, name, list->supports[i].description); data/gfsecret-0.4.6/src/gfsec-split.c:434:22: [4] (shell) system: 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. status = system(cfg->destroy); data/gfsecret-0.4.6/src/gfsec-use.c:126:9: [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(buffer, filename); data/gfsecret-0.4.6/src/gfsec-use.c:167:18: [4] (shell) system: 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. status = system(delete_cmd); data/gfsecret-0.4.6/src/gfsec-use.c:284:23: [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. if ( ! (out = popen(restore_cmd, "w")) ) data/gfsecret-0.4.6/src/gfsec-use.c:311:13: [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. execvp(argv[optind], &(argv[optind])); data/gfsecret-0.4.6/src/gfsec-use.c:325:13: [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. execvp(shell, args); data/gfsecret-0.4.6/src/gfsec-split.c:230:26: [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. if ( (env_info = getenv("XDG_CONFIG_HOME")) && *env_info) data/gfsecret-0.4.6/src/gfsec-split.c:232:31: [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. else if ( (env_info = getenv("HOME")) && *env_info ) data/gfsecret-0.4.6/src/gfsec-split.c:297:5: [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(time(NULL)); data/gfsecret-0.4.6/src/gfsec-split.c:301:18: [3] (buffer) getopt_long: 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. while ( (c = getopt_long(argc, argv, "hvn:s:ic:ko:r:d:l", data/gfsecret-0.4.6/src/gfsec-use.c:96:22: [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. if ( (env_info = getenv("XDG_CONFIG_HOME")) && *env_info ) data/gfsecret-0.4.6/src/gfsec-use.c:98:27: [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. else if ( (env_info = getenv("HOME")) && *env_info ) data/gfsecret-0.4.6/src/gfsec-use.c:205:18: [3] (buffer) getopt_long: 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. while ( (c = getopt_long(argc, argv, "hvc:ko:r:d:", data/gfsecret-0.4.6/src/gfsec-use.c:316:29: [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. if ( ! (shell = getenv("SHELL")) ) data/gfsecret-0.4.6/src/secret.c:371:19: [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. nr = (random() & 0xFF00) >> 8; data/gfsecret-0.4.6/src/gfsec-split.c:196: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 buffer[255]; data/gfsecret-0.4.6/src/gfsec-split.c:360:9: [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 fmt[32], name[64]; data/gfsecret-0.4.6/src/gfsec-use.c:141: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 buffer[256]; data/gfsecret-0.4.6/src/gfsec-use.c:180: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 cfg_path[255]; data/gfsecret-0.4.6/src/gfsec-use.c:314:13: [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 *shell, *args[3]; data/gfsecret-0.4.6/src/scheme-libmtp.c:262:5: [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(cb_data->buffer + cb_data->written, data, sendlen); data/gfsecret-0.4.6/src/scheme-libmtp.c:333:5: [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(data, cb_data->buffer + cb_data->written, wantlen); data/gfsecret-0.4.6/src/secret.c:178:9: [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(share->hash, hash, 32); data/gfsecret-0.4.6/src/secret.c:211:18: [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. unsigned char hash[32]; data/gfsecret-0.4.6/src/secret.c:468:9: [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(secret->data, secret->full_share->data, secret->len); data/gfsecret-0.4.6/src/secret.c:471:18: [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. unsigned char sharenrs[255]; data/gfsecret-0.4.6/src/secret.c:531:14: [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. unsigned char sharenrs[255]; data/gfsecret-0.4.6/src/secret.c:573:17: [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(share->data, secret->data, secret->len); data/gfsecret-0.4.6/src/secret.c:576:13: [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(share->hash, gcry_md_read(md, 0), 32); data/gfsecret-0.4.6/src/secretcfg.c:328: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 buffer[MAX_LINE_LENGTH]; data/gfsecret-0.4.6/src/secretcfg.c:334:17: [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 ( ! (f = fopen(filename, "r")) ) data/gfsecret-0.4.6/src/secretcfg.c:401: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 buffer[65]; data/gfsecret-0.4.6/src/secretcfg.c:409:17: [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 ( ! (f = fopen(filename, "w")) ) data/gfsecret-0.4.6/src/secretcfg.c:427:13: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(buffer + (m*2), "%02x", share->hash[m]); data/gfsecret-0.4.6/src/util.c:95: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). if ( (f = fopen(filename, "r")) ) { data/gfsecret-0.4.6/src/util.c:139: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). if ( (f = fopen(filename, "w")) ) { data/gfsecret-0.4.6/lib/xmem.c:78: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). len = strlen(s); data/gfsecret-0.4.6/lib/xmem.c:95:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(dup, s, n); data/gfsecret-0.4.6/src/gfsec-use.c:124:15: [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). else if ( strlen(filename) < len ) { data/gfsecret-0.4.6/src/secretcfg.c:53:18: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ( (c = fgetc(f)) != '\n' ) { data/gfsecret-0.4.6/src/secretcfg.c:58:26: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ( (c = fgetc(f)) != '\n' && c != EOF ) ; /* Discard line */ data/gfsecret-0.4.6/src/secretcfg.c:227: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). len = strlen(path); data/gfsecret-0.4.6/src/util.c:168:13: [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). n = strlen(path); ANALYSIS SUMMARY: Hits = 48 Lines analyzed = 4433 in approximately 0.14 seconds (31661 lines/second) Physical Source Lines of Code (SLOC) = 2510 Hits@level = [0] 26 [1] 7 [2] 21 [3] 9 [4] 11 [5] 0 Hits@level+ = [0+] 74 [1+] 48 [2+] 41 [3+] 20 [4+] 11 [5+] 0 Hits/KSLOC@level+ = [0+] 29.4821 [1+] 19.1235 [2+] 16.3347 [3+] 7.96813 [4+] 4.38247 [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.