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/klustakwik-2.0.1/KlustaKwik.C Examining data/klustakwik-2.0.1/param.h Examining data/klustakwik-2.0.1/Array.h Examining data/klustakwik-2.0.1/KlustaKwik.h Examining data/klustakwik-2.0.1/param.c FINAL RESULTS: data/klustakwik-2.0.1/KlustaKwik.C:78:2: [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(FileBase, argv[1]); data/klustakwik-2.0.1/KlustaKwik.C:85:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(fname, "%s.klg.%d", FileBase, ElecNo); data/klustakwik-2.0.1/KlustaKwik.C:96: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, arg); data/klustakwik-2.0.1/KlustaKwik.C:109:2: [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. vsnprintf(str,STRLEN,fmt,arg); data/klustakwik-2.0.1/KlustaKwik.C:171:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(fname, "%s.clu.%d", FileBase, ElecNo); data/klustakwik-2.0.1/KlustaKwik.C:286:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(fname, "%s.fet.%d", FileBase, ElecNo); data/klustakwik-2.0.1/param.c:87:3: [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(fp, HelpString); data/klustakwik-2.0.1/KlustaKwik.C:940: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(RandomSeed); data/klustakwik-2.0.1/KlustaKwik.C:16:1: [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 FileBase[STRLEN] = "tetrode"; data/klustakwik-2.0.1/KlustaKwik.C:25:1: [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 UseFeatures[STRLEN] = "11111111111100001"; data/klustakwik-2.0.1/KlustaKwik.C:34:1: [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 StartCluFile[STRLEN] = ""; data/klustakwik-2.0.1/KlustaKwik.C:44: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 fname[STRLEN]; data/klustakwik-2.0.1/KlustaKwik.C:79:11: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). ElecNo = atoi(argv[2]); data/klustakwik-2.0.1/KlustaKwik.C:105: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 str[STRLEN]; data/klustakwik-2.0.1/KlustaKwik.C:126: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(fname, mode); data/klustakwik-2.0.1/KlustaKwik.C:150: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 fname[STRLEN]; data/klustakwik-2.0.1/KlustaKwik.C:275: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 fname[STRLEN]; data/klustakwik-2.0.1/KlustaKwik.C:276: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 line[STRLEN]; data/klustakwik-2.0.1/KlustaKwik.C:943:25: [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 (DistDump) Distfp = fopen("DISTDUMP", "w"); data/klustakwik-2.0.1/param.c:29:25: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). *((int *) e->addr) = atoi(value); break; data/klustakwik-2.0.1/KlustaKwik.C:303: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). UseLen = strlen(UseFeatures); data/klustakwik-2.0.1/KlustaKwik.C:841:4: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). getchar(); data/klustakwik-2.0.1/param.c:37:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy((char *)e->addr, value, STRLEN); break; ANALYSIS SUMMARY: Hits = 23 Lines analyzed = 1309 in approximately 0.08 seconds (15409 lines/second) Physical Source Lines of Code (SLOC) = 920 Hits@level = [0] 20 [1] 3 [2] 12 [3] 1 [4] 7 [5] 0 Hits@level+ = [0+] 43 [1+] 23 [2+] 20 [3+] 8 [4+] 7 [5+] 0 Hits/KSLOC@level+ = [0+] 46.7391 [1+] 25 [2+] 21.7391 [3+] 8.69565 [4+] 7.6087 [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.