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/nutcracker-0.4.1+dfsg/src/nc_stats.h Examining data/nutcracker-0.4.1+dfsg/src/nc_server.c Examining data/nutcracker-0.4.1+dfsg/src/nc_string.h Examining data/nutcracker-0.4.1+dfsg/src/nc_proxy.c Examining data/nutcracker-0.4.1+dfsg/src/nc_response.c Examining data/nutcracker-0.4.1+dfsg/src/nc_signal.c Examining data/nutcracker-0.4.1+dfsg/src/nc_rbtree.h Examining data/nutcracker-0.4.1+dfsg/src/nc_rbtree.c Examining data/nutcracker-0.4.1+dfsg/src/nc_proxy.h Examining data/nutcracker-0.4.1+dfsg/src/nc_request.c Examining data/nutcracker-0.4.1+dfsg/src/nc_util.c Examining data/nutcracker-0.4.1+dfsg/src/nc_client.c Examining data/nutcracker-0.4.1+dfsg/src/nc_server.h Examining data/nutcracker-0.4.1+dfsg/src/proto/nc_proto.h Examining data/nutcracker-0.4.1+dfsg/src/proto/nc_redis.c Examining data/nutcracker-0.4.1+dfsg/src/proto/nc_memcache.c Examining data/nutcracker-0.4.1+dfsg/src/nc_array.h Examining data/nutcracker-0.4.1+dfsg/src/nc_util.h Examining data/nutcracker-0.4.1+dfsg/src/nc_mbuf.c Examining data/nutcracker-0.4.1+dfsg/src/nc_message.c Examining data/nutcracker-0.4.1+dfsg/src/nc_signal.h Examining data/nutcracker-0.4.1+dfsg/src/nc_string.c Examining data/nutcracker-0.4.1+dfsg/src/nc_connection.h Examining data/nutcracker-0.4.1+dfsg/src/nc_queue.h Examining data/nutcracker-0.4.1+dfsg/src/nc_log.h Examining data/nutcracker-0.4.1+dfsg/src/nc_array.c Examining data/nutcracker-0.4.1+dfsg/src/nc_client.h Examining data/nutcracker-0.4.1+dfsg/src/nc_connection.c Examining data/nutcracker-0.4.1+dfsg/src/nc_log.c Examining data/nutcracker-0.4.1+dfsg/src/nc_core.c Examining data/nutcracker-0.4.1+dfsg/src/hashkit/nc_random.c Examining data/nutcracker-0.4.1+dfsg/src/hashkit/nc_fnv.c Examining data/nutcracker-0.4.1+dfsg/src/hashkit/nc_murmur.c Examining data/nutcracker-0.4.1+dfsg/src/hashkit/nc_md5.c Examining data/nutcracker-0.4.1+dfsg/src/hashkit/nc_crc16.c Examining data/nutcracker-0.4.1+dfsg/src/hashkit/nc_modula.c Examining data/nutcracker-0.4.1+dfsg/src/hashkit/nc_crc32.c Examining data/nutcracker-0.4.1+dfsg/src/hashkit/nc_hsieh.c Examining data/nutcracker-0.4.1+dfsg/src/hashkit/nc_ketama.c Examining data/nutcracker-0.4.1+dfsg/src/hashkit/nc_one_at_a_time.c Examining data/nutcracker-0.4.1+dfsg/src/hashkit/nc_hashkit.h Examining data/nutcracker-0.4.1+dfsg/src/hashkit/nc_jenkins.c Examining data/nutcracker-0.4.1+dfsg/src/nc_stats.c Examining data/nutcracker-0.4.1+dfsg/src/nc_mbuf.h Examining data/nutcracker-0.4.1+dfsg/src/nc_conf.h Examining data/nutcracker-0.4.1+dfsg/src/nc_conf.c Examining data/nutcracker-0.4.1+dfsg/src/nc_message.h Examining data/nutcracker-0.4.1+dfsg/src/nc_core.h Examining data/nutcracker-0.4.1+dfsg/src/event/nc_epoll.c Examining data/nutcracker-0.4.1+dfsg/src/event/nc_event.h Examining data/nutcracker-0.4.1+dfsg/src/event/nc_kqueue.c Examining data/nutcracker-0.4.1+dfsg/src/event/nc_evport.c Examining data/nutcracker-0.4.1+dfsg/src/nc.c FINAL RESULTS: data/nutcracker-0.4.1+dfsg/src/nc_proxy.c:154:18: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. status = chmod(un->sun_path, pool->perm); data/nutcracker-0.4.1+dfsg/src/nc_string.h:95:5: [4] (format) snprintf: 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. snprintf((char *)(_s), (size_t)(_n), __VA_ARGS__) data/nutcracker-0.4.1+dfsg/src/nc_string.h:101:5: [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((char *)(_s), (size_t)(_n), _f, _a) data/nutcracker-0.4.1+dfsg/src/nc_util.c:329: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(buf, size, fmt, args); data/nutcracker-0.4.1+dfsg/src/hashkit/nc_hashkit.h:41:33: [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. ACTION( DIST_RANDOM, random ) \ data/nutcracker-0.4.1+dfsg/src/hashkit/nc_random.c:98:9: [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((uint32_t)time(NULL)); data/nutcracker-0.4.1+dfsg/src/hashkit/nc_random.c:143: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. c = continuum + random() % ncontinuum; data/nutcracker-0.4.1+dfsg/src/nc.c:310:13: [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. c = getopt_long(argc, argv, short_options, long_options, NULL); data/nutcracker-0.4.1+dfsg/src/hashkit/nc_ketama.c:33: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 results[16]; data/nutcracker-0.4.1+dfsg/src/hashkit/nc_ketama.c:174: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 host[KETAMA_MAX_HOSTLEN]= ""; data/nutcracker-0.4.1+dfsg/src/hashkit/nc_md5.c:36: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 buffer[64]; data/nutcracker-0.4.1+dfsg/src/hashkit/nc_md5.c:226: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(&ctx->buffer[used], data, size); data/nutcracker-0.4.1+dfsg/src/hashkit/nc_md5.c:230: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(&ctx->buffer[used], data, free); data/nutcracker-0.4.1+dfsg/src/hashkit/nc_md5.c:241: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(ctx->buffer, data, size); data/nutcracker-0.4.1+dfsg/src/hashkit/nc_md5.c:313: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 results[16]; data/nutcracker-0.4.1+dfsg/src/nc.c:134:10: [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("/dev/null", O_RDWR); data/nutcracker-0.4.1+dfsg/src/nc.c:234: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 pid[NC_UINTMAX_MAXLEN]; data/nutcracker-0.4.1+dfsg/src/nc.c:238:10: [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(nci->pid_filename, O_WRONLY | O_CREAT | O_TRUNC, 0644); data/nutcracker-0.4.1+dfsg/src/nc_conf.c:749:10: [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). fh = fopen(filename, "r"); data/nutcracker-0.4.1+dfsg/src/nc_core.h:145: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 hostname[NC_MAXHOSTNAMELEN]; /* hostname */ data/nutcracker-0.4.1+dfsg/src/nc_log.c:39:17: [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). l->fd = open(name, O_WRONLY | O_APPEND | O_CREAT, 0644); data/nutcracker-0.4.1+dfsg/src/nc_log.c:69:17: [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). l->fd = open(l->name, O_WRONLY | O_APPEND | O_CREAT, 0644); data/nutcracker-0.4.1+dfsg/src/nc_log.c:136: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 buf[LOG_MAX_LEN]; data/nutcracker-0.4.1+dfsg/src/nc_log.c:178: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 buf[4 * LOG_MAX_LEN]; data/nutcracker-0.4.1+dfsg/src/nc_log.c:209: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 buf[8 * LOG_MAX_LEN]; data/nutcracker-0.4.1+dfsg/src/nc_log.c:277: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 buf[LOG_MAX_LEN]; data/nutcracker-0.4.1+dfsg/src/nc_log.c:310: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 buf[LOG_MAX_LEN]; data/nutcracker-0.4.1+dfsg/src/nc_string.c:238:21: [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 buff[22]; data/nutcracker-0.4.1+dfsg/src/nc_string.h:57: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(_d, _c, (size_t)(_n)) data/nutcracker-0.4.1+dfsg/src/nc_util.c:463: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 *node, service[NC_UINTMAX_MAXLEN]; data/nutcracker-0.4.1+dfsg/src/nc_util.c:574: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. static char unresolve[NI_MAXHOST + NI_MAXSERV]; data/nutcracker-0.4.1+dfsg/src/nc_util.c:575: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. static char host[NI_MAXHOST], service[NI_MAXSERV]; data/nutcracker-0.4.1+dfsg/src/nc.c:130:5: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(0); data/nutcracker-0.4.1+dfsg/src/nc.c:340:37: [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). value = nc_atoi(optarg, strlen(optarg)); data/nutcracker-0.4.1+dfsg/src/nc.c:357:37: [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). value = nc_atoi(optarg, strlen(optarg)); data/nutcracker-0.4.1+dfsg/src/nc.c:372:37: [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). value = nc_atoi(optarg, strlen(optarg)); data/nutcracker-0.4.1+dfsg/src/nc.c:390:37: [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). value = nc_atoi(optarg, strlen(optarg)); data/nutcracker-0.4.1+dfsg/src/nc_log.c:36: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). if (name == NULL || !strlen(name)) { data/nutcracker-0.4.1+dfsg/src/nc_string.h:66:5: [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). strlen((char *)(_s)) data/nutcracker-0.4.1+dfsg/src/nc_util.h:139:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(_d, _b, (size_t)(_n)) ANALYSIS SUMMARY: Hits = 40 Lines analyzed = 20448 in approximately 0.45 seconds (44996 lines/second) Physical Source Lines of Code (SLOC) = 14328 Hits@level = [0] 5 [1] 8 [2] 24 [3] 4 [4] 3 [5] 1 Hits@level+ = [0+] 45 [1+] 40 [2+] 32 [3+] 8 [4+] 4 [5+] 1 Hits/KSLOC@level+ = [0+] 3.1407 [1+] 2.79174 [2+] 2.23339 [3+] 0.558347 [4+] 0.279174 [5+] 0.0697934 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.