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/kafs-client-0.5/src/aklog-kafs.c Examining data/kafs-client-0.5/src/dns_afsdb.h Examining data/kafs-client-0.5/src/dns_afsdb_text.c Examining data/kafs-client-0.5/src/dns_afsdb_v1.c Examining data/kafs-client-0.5/src/dns_main.c Examining data/kafs-client-0.5/src/dns_resolver.h Examining data/kafs-client-0.5/src/include/kafs/cellserv.h Examining data/kafs-client-0.5/src/include/kafs/profile.h Examining data/kafs-client-0.5/src/include/kafs/reporting.h Examining data/kafs-client-0.5/src/kafs-check-config.c Examining data/kafs-client-0.5/src/lib_cell_lookup.c Examining data/kafs-client-0.5/src/lib_cellserv.c Examining data/kafs-client-0.5/src/lib_dns_lookup.c Examining data/kafs-client-0.5/src/lib_object.c Examining data/kafs-client-0.5/src/lib_profile.c Examining data/kafs-client-0.5/src/preload-cells.c FINAL RESULTS: data/kafs-client-0.5/src/dns_main.c:72:3: [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, va); data/kafs-client-0.5/src/dns_main.c:102:3: [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, va); data/kafs-client-0.5/src/dns_main.c:120:3: [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(stdout, fmt, va); data/kafs-client-0.5/src/include/kafs/reporting.h:17:25: [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. __attribute__((format(printf, 1, 2))); data/kafs-client-0.5/src/include/kafs/reporting.h:19:25: [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. __attribute__((format(printf, 1, 2))); data/kafs-client-0.5/src/include/kafs/reporting.h:21:25: [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. __attribute__((format(printf, 1, 2))); data/kafs-client-0.5/src/kafs-check-config.c:24: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, va); data/kafs-client-0.5/src/kafs-check-config.c:35:2: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(fmt, va); data/kafs-client-0.5/src/preload-cells.c:39:3: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(fmt, va); data/kafs-client-0.5/src/preload-cells.c:56:3: [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, va); data/kafs-client-0.5/src/aklog-kafs.c:110:42: [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. static void des3_strip_parity_bits(void *random, const void *key) data/kafs-client-0.5/src/aklog-kafs.c:113:21: [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. unsigned char *r = random, lsbs; data/kafs-client-0.5/src/aklog-kafs.c:128:46: [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. static unsigned int des3_key_to_random(void *random, const void *key, unsigned int len) data/kafs-client-0.5/src/aklog-kafs.c:133:26: [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. des3_strip_parity_bits(random, key); data/kafs-client-0.5/src/dns_main.c:237:16: [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 ((ret = getopt_long(argc, argv, "Dvc:N:o:V", long_options, NULL)) != -1) { data/kafs-client-0.5/src/kafs-check-config.c:70:15: [3] (buffer) getopt: 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 (opt = getopt(argc, argv, "46PDc:vN:"), data/kafs-client-0.5/src/preload-cells.c:163:15: [3] (buffer) getopt: 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 (opt = getopt(argc, argv, "Dv"), data/kafs-client-0.5/src/aklog-kafs.c:176:11: [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 Label[6]; data/kafs-client-0.5/src/aklog-kafs.c:177:11: [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 L_2[4]; data/kafs-client-0.5/src/aklog-kafs.c:199:12: [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 md5[MD5_DIGEST_SIZE]; data/kafs-client-0.5/src/aklog-kafs.c:226:2: [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(session_key, &buf.n_des, sizeof(buf.n_des)); data/kafs-client-0.5/src/aklog-kafs.c:285:2: [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(session_key, creds->keyblock.contents, length); data/kafs-client-0.5/src/aklog-kafs.c:309: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 buf[260], *nl, *cell; data/kafs-client-0.5/src/aklog-kafs.c:312:7: [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). fd = open(rootcell, O_RDONLY); data/kafs-client-0.5/src/aklog-kafs.c:418:2: [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(payload->ticket, creds->ticket.data, creds->ticket.length); data/kafs-client-0.5/src/dns_afsdb_text.c:27:2: [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(*_b, p, len); data/kafs-client-0.5/src/dns_afsdb_text.c:42: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 buf[100]; data/kafs-client-0.5/src/dns_afsdb_text.c:79:5: [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(buf, "%u", server->port); data/kafs-client-0.5/src/dns_afsdb_v1.c:31:2: [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(*_b, p, n); data/kafs-client-0.5/src/dns_main.c:202:21: [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). output_version = atoi(val); data/kafs-client-0.5/src/dns_main.c:224:8: [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. const char *filev[10], **filep = NULL; data/kafs-client-0.5/src/dns_main.c:388:12: [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). int fd = open(dump_file, O_WRONLY | O_CREAT | O_TRUNC, 0644); data/kafs-client-0.5/src/kafs-check-config.c:63:8: [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. const char *filev[10], **filep = NULL; data/kafs-client-0.5/src/lib_cellserv.c:301: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. static const char *const kafs_record_sources[nr__kafs_record_source] = { data/kafs-client-0.5/src/lib_cellserv.c:310: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. static const char *const kafs_lookup_statuses[nr__kafs_lookup_status] = { data/kafs-client-0.5/src/lib_cellserv.c:343: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 buf[100]; data/kafs-client-0.5/src/lib_dns_lookup.c:212: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 buf[MAXDNAME]; data/kafs-client-0.5/src/lib_dns_lookup.c:373: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 buf[MAXDNAME]; data/kafs-client-0.5/src/lib_dns_lookup.c:479: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 name[1024]; data/kafs-client-0.5/src/lib_object.c:131:2: [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(to->servers, from->servers, nr * sizeof(struct kafs_server)); data/kafs-client-0.5/src/lib_profile.c:311:7: [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). fd = open(file, O_RDONLY); data/kafs-client-0.5/src/preload-cells.c:79:7: [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). fd = open(file, O_WRONLY); data/kafs-client-0.5/src/preload-cells.c:103: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 buf[4096]; data/kafs-client-0.5/src/preload-cells.c:107:8: [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). fd = open("/proc/fs/afs/cells", O_WRONLY); data/kafs-client-0.5/src/aklog-kafs.c:164:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(sock, md, md_len); data/kafs-client-0.5/src/aklog-kafs.c:314:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). n = read(fd, buf, sizeof(buf) - 2); data/kafs-client-0.5/src/dns_afsdb_text.c:25:21: [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). unsigned int len = strlen(p); data/kafs-client-0.5/src/dns_afsdb_v1.c:54: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). n = strlen(server->name); data/kafs-client-0.5/src/dns_main.c:178: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). options = k + strlen(k); data/kafs-client-0.5/src/lib_profile.c:326:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). n = read(fd, buffer, st.st_size); data/kafs-client-0.5/src/lib_profile.c:363: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). n = strlen(de->d_name); data/kafs-client-0.5/src/preload-cells.c:85:6: [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(str); ANALYSIS SUMMARY: Hits = 52 Lines analyzed = 3777 in approximately 0.11 seconds (33321 lines/second) Physical Source Lines of Code (SLOC) = 2711 Hits@level = [0] 62 [1] 8 [2] 27 [3] 7 [4] 10 [5] 0 Hits@level+ = [0+] 114 [1+] 52 [2+] 44 [3+] 17 [4+] 10 [5+] 0 Hits/KSLOC@level+ = [0+] 42.0509 [1+] 19.1811 [2+] 16.2302 [3+] 6.27075 [4+] 3.68868 [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.