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/cwdaemon-0.10.2/examples/example.c Examining data/cwdaemon-0.10.2/src/cwdaemon.c Examining data/cwdaemon-0.10.2/src/cwdaemon.h Examining data/cwdaemon-0.10.2/src/lp.c Examining data/cwdaemon-0.10.2/src/null.c Examining data/cwdaemon-0.10.2/src/ttys.c FINAL RESULTS: data/cwdaemon-0.10.2/examples/example.c:164:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf, "%s", cwmessage); data/cwdaemon-0.10.2/examples/example.c:169:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf + 2, "%s", cwmessage); data/cwdaemon-0.10.2/examples/example.c:174:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf + 2, "%s", cwmessage); data/cwdaemon-0.10.2/examples/example.c:191:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf + 2, "%s", cwmessage); data/cwdaemon-0.10.2/examples/example.c:196:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf + 2, "%s", cwmessage); data/cwdaemon-0.10.2/examples/example.c:201:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf + 2, "%s", cwmessage); data/cwdaemon-0.10.2/examples/example.c:206:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf + 2, "%s", cwmessage); data/cwdaemon-0.10.2/examples/example.c:211:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf + 2, "%s", cwmessage); data/cwdaemon-0.10.2/examples/example.c:216:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf + 2, "%s", cwmessage); data/cwdaemon-0.10.2/examples/example.c:221:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf + 2, "%s", cwmessage); data/cwdaemon-0.10.2/src/cwdaemon.c:428:41: [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. static bool cwdaemon_params_system(int *system, const char *optarg); data/cwdaemon-0.10.2/src/cwdaemon.c:527: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(s, 1024, format, ap); data/cwdaemon-0.10.2/src/cwdaemon.c:571:3: [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(s, 1024, format, ap); data/cwdaemon-0.10.2/src/cwdaemon.c:1205:4: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(request_queue, request_buffer); data/cwdaemon-0.10.2/src/cwdaemon.c:2314:34: [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. bool cwdaemon_params_system(int *system, const char *optarg) data/cwdaemon-0.10.2/src/cwdaemon.c:2338:88: [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. "requested sound system: \"%s\" (\"%s\")", optarg, cw_get_audio_system_label(*system)); data/cwdaemon-0.10.2/src/cwdaemon.c:1811:14: [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, cwdaemon_args_short, cwdaemon_args_long, &option_index)) != -1) { data/cwdaemon-0.10.2/src/cwdaemon.c:2411:14: [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 ((p = getopt(argc, argv, cwdaemon_args_short)) != -1) { data/cwdaemon-0.10.2/examples/example.c:66: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. static char netkeyer_hostaddress[16] = "127.0.0.1"; data/cwdaemon-0.10.2/examples/example.c:156: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[80]; data/cwdaemon-0.10.2/src/cwdaemon.c:282: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. static char reply_buffer[CWDAEMON_MESSAGE_SIZE_MAX]; data/cwdaemon-0.10.2/src/cwdaemon.c:319: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. static char request_queue[CWDAEMON_REQUEST_QUEUE_SIZE_MAX]; data/cwdaemon-0.10.2/src/cwdaemon.c:437: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. static char cwdaemon_debug_ptt_flag[3 + 1]; data/cwdaemon-0.10.2/src/cwdaemon.c:524: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 s[1025]; data/cwdaemon-0.10.2/src/cwdaemon.c:569:3: [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 s[1024 + 1]; data/cwdaemon-0.10.2/src/cwdaemon.c:1173: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 request_buffer[CWDAEMON_MESSAGE_SIZE_MAX + 1]; data/cwdaemon-0.10.2/src/cwdaemon.c:1305:3: [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 address[INET_ADDRSTRLEN]; data/cwdaemon-0.10.2/src/cwdaemon.c:1731:3: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(reply_buffer, "\r\n"); /* Ensure exactly one CRLF */ data/cwdaemon-0.10.2/src/cwdaemon.c:2509:22: [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). cwdaemon_debug_f = fopen(cwdaemon_debug_f_path, "w+"); data/cwdaemon-0.10.2/src/cwdaemon.c:2679:13: [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). if ((fd = open("/dev/null", O_RDWR, 0)) == -1) { data/cwdaemon-0.10.2/src/lp.c:86: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. char nm[MAXPATHLEN]; data/cwdaemon-0.10.2/src/lp.c:93:18: [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). if ((fd = open(nm, O_RDWR | O_NONBLOCK)) == -1) data/cwdaemon-0.10.2/src/lp.c:111: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. char nm[MAXPATHLEN]; data/cwdaemon-0.10.2/src/lp.c:119:18: [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). if ((fd = open(nm, O_RDWR | O_NONBLOCK)) == -1) data/cwdaemon-0.10.2/src/ttys.c:78: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 nm[MAXPATHLEN]; data/cwdaemon-0.10.2/src/ttys.c:85: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). if ((fd = open(nm, O_RDWR | O_NOCTTY | O_NONBLOCK)) == -1) data/cwdaemon-0.10.2/examples/example.c:161:4: [1] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source is a constant character. sprintf(buf + 1, "0"); data/cwdaemon-0.10.2/examples/example.c:168:4: [1] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source is a constant character. sprintf(buf + 1, "2"); data/cwdaemon-0.10.2/examples/example.c:173:4: [1] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source is a constant character. sprintf(buf + 1, "3"); data/cwdaemon-0.10.2/examples/example.c:178:4: [1] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source is a constant character. sprintf(buf + 1, "4"); data/cwdaemon-0.10.2/examples/example.c:182:4: [1] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source is a constant character. sprintf(buf + 1, "5"); data/cwdaemon-0.10.2/examples/example.c:186:4: [1] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source is a constant character. sprintf(buf + 1, "6"); data/cwdaemon-0.10.2/examples/example.c:190:4: [1] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source is a constant character. sprintf(buf + 1, "7"); data/cwdaemon-0.10.2/examples/example.c:195:4: [1] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source is a constant character. sprintf(buf + 1, "8"); data/cwdaemon-0.10.2/examples/example.c:200:4: [1] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source is a constant character. sprintf(buf + 1, "a"); data/cwdaemon-0.10.2/examples/example.c:205:4: [1] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source is a constant character. sprintf(buf + 1, "c"); data/cwdaemon-0.10.2/examples/example.c:210:4: [1] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source is a constant character. sprintf(buf + 1, "d"); data/cwdaemon-0.10.2/examples/example.c:215:4: [1] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source is a constant character. sprintf(buf + 1, "f"); data/cwdaemon-0.10.2/examples/example.c:220:4: [1] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source is a constant character. sprintf(buf + 1, "g"); data/cwdaemon-0.10.2/src/cwdaemon.c:1049:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(reply, request, n); data/cwdaemon-0.10.2/src/cwdaemon.c:1075: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). size_t len = strlen(reply); data/cwdaemon-0.10.2/src/cwdaemon.c:1204: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(request_buffer) + strlen(request_queue)) <= CWDAEMON_REQUEST_QUEUE_SIZE_MAX - 1) { data/cwdaemon-0.10.2/src/cwdaemon.c:1204:33: [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(request_buffer) + strlen(request_queue)) <= CWDAEMON_REQUEST_QUEUE_SIZE_MAX - 1) { data/cwdaemon-0.10.2/src/cwdaemon.c:1522:53: [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). cwdaemon_prepare_reply(reply_buffer, request + 1, strlen(request + 1)); data/cwdaemon-0.10.2/src/cwdaemon.c:1586:50: [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). cwdaemon_prepare_reply(reply_buffer, request, strlen(request)); data/cwdaemon-0.10.2/src/cwdaemon.c:2675:3: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(0); data/cwdaemon-0.10.2/src/cwdaemon.c:2881:16: [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 (!desc || !strlen(desc)) { ANALYSIS SUMMARY: Hits = 57 Lines analyzed = 4196 in approximately 0.17 seconds (24780 lines/second) Physical Source Lines of Code (SLOC) = 2425 Hits@level = [0] 110 [1] 21 [2] 18 [3] 2 [4] 16 [5] 0 Hits@level+ = [0+] 167 [1+] 57 [2+] 36 [3+] 18 [4+] 16 [5+] 0 Hits/KSLOC@level+ = [0+] 68.866 [1+] 23.5052 [2+] 14.8454 [3+] 7.42268 [4+] 6.59794 [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.