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/wmcliphist-2.1/clipboard.c Examining data/wmcliphist-2.1/debug.c Examining data/wmcliphist-2.1/debug.h Examining data/wmcliphist-2.1/history.c Examining data/wmcliphist-2.1/hotkeys.c Examining data/wmcliphist-2.1/rcconfig.c Examining data/wmcliphist-2.1/utils.c Examining data/wmcliphist-2.1/wmcliphist.h Examining data/wmcliphist-2.1/wmcliphist.c Examining data/wmcliphist-2.1/gui.c FINAL RESULTS: data/wmcliphist-2.1/history.c:289:7: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if ((chmod(fname, S_IRUSR|S_IWUSR)) != 0) { data/wmcliphist-2.1/debug.c:82:2: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. vsprintf(msg_buf, format, args); data/wmcliphist-2.1/debug.c:87:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(final_msg, "%d: %.*s%s", getpid(), *align, tabs, msg_buf); data/wmcliphist-2.1/gui.c:192:3: [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(menu_item_name, content); data/wmcliphist-2.1/gui.c:203: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(fixed_menu_item_name, decoded_char); data/wmcliphist-2.1/history.c:147:2: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(exec_buf, action->command, converted); data/wmcliphist-2.1/history.c:150:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(msg_buf, "Do you want to perform the " data/wmcliphist-2.1/history.c:161:9: [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. res = system(exec_buf); data/wmcliphist-2.1/hotkeys.c:159:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(msg_str, "Invalid menu hotkey '%s'.\nFalling back to " data/wmcliphist-2.1/hotkeys.c:162:3: [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(menukey_str, DEF_MENUKEY); data/wmcliphist-2.1/hotkeys.c:166:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(msg_str, "Invalid previous item hotkey '%s'.\n" data/wmcliphist-2.1/hotkeys.c:174:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(msg_str, "Invalid exec hotkey '%s'.\n" data/wmcliphist-2.1/wmcliphist.c:327:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(msg_str, "Invalid color string: '%s'.\n" data/wmcliphist-2.1/wmcliphist.c:331:3: [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(locked_color_str, DEF_LOCKED_COLOR); data/wmcliphist-2.1/wmcliphist.c:345:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(msg_str, "Invalid clipboard string: '%s'.\n" data/wmcliphist-2.1/debug.c:10: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 tabs[1024]; data/wmcliphist-2.1/debug.c:71: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 msg_buf[1024]; data/wmcliphist-2.1/debug.c:72: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 final_msg[2048]; data/wmcliphist-2.1/debug.c:85:2: [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(msg_buf, " {\n"); data/wmcliphist-2.1/gui.c:190: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(menu_item_name, "..."); data/wmcliphist-2.1/history.c:193:12: [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(fname, "r"))) { data/wmcliphist-2.1/history.c:282:12: [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(fname, "w"))) { data/wmcliphist-2.1/hotkeys.c:154: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 msg_str[128]; data/wmcliphist-2.1/rcconfig.c:102: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 tmp[1024], c; data/wmcliphist-2.1/rcconfig.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 direc_buf[RC_BUF_SIZE], data/wmcliphist-2.1/rcconfig.c:117: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). close(open(fname, O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)); data/wmcliphist-2.1/rcconfig.c:119:14: [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 ((f_rc = open(fname, O_RDONLY)) < 0) { data/wmcliphist-2.1/rcconfig.c:229:8: [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). atoi(expr_buf); data/wmcliphist-2.1/rcconfig.c:242:8: [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). atoi(expr_buf); data/wmcliphist-2.1/wmcliphist.c:133:25: [2] (integer) atol: 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). num_items_to_keep = atol(argv[i]); data/wmcliphist-2.1/wmcliphist.c:148:19: [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). icon_number = atoi(argv[i]); data/wmcliphist-2.1/wmcliphist.c:159:17: [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). icon_size = atoi(argv[i]); data/wmcliphist-2.1/wmcliphist.c:325: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 msg_str[128]; data/wmcliphist-2.1/wmcliphist.c:343: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 msg_str[128]; data/wmcliphist-2.1/clipboard.c:197: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(converted)); data/wmcliphist-2.1/gui.c:196:38: [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). fixed_menu_item_name = g_new0(char, strlen(menu_item_name) + 1); data/wmcliphist-2.1/gui.c:206:4: [1] (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 character. strcat(fixed_menu_item_name, "_"); data/wmcliphist-2.1/history.c:145: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). exec_buf = g_new0(char, strlen(converted) + data/wmcliphist-2.1/history.c:146:4: [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(action->command) + 1); data/wmcliphist-2.1/history.c:149: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). msg_buf = g_new0(char, strlen(exec_buf) + 256); data/wmcliphist-2.1/history.c:311:12: [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). length = strlen(hist_item->content); data/wmcliphist-2.1/hotkeys.c:81:27: [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). char *tmp = g_new0(char, strlen(hotkey)); data/wmcliphist-2.1/hotkeys.c:88: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). for (i = 0; i < strlen(hotkey); i++) { data/wmcliphist-2.1/rcconfig.c:127:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). byte_cnt = read(f_rc, tmp, 1024); data/wmcliphist-2.1/rcconfig.c:217:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(menukey_str, data/wmcliphist-2.1/rcconfig.c:221:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(prev_item_key_str, data/wmcliphist-2.1/rcconfig.c:225:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(exec_item_key_str, data/wmcliphist-2.1/rcconfig.c:233:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(locked_color_str, data/wmcliphist-2.1/rcconfig.c:238:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(clipboard_str, data/wmcliphist-2.1/wmcliphist.c:141:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(locked_color_str, argv[i], 31); data/wmcliphist-2.1/wmcliphist.c:182:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(clipboard_str, argv[i], 31); ANALYSIS SUMMARY: Hits = 51 Lines analyzed = 2701 in approximately 0.08 seconds (34765 lines/second) Physical Source Lines of Code (SLOC) = 1869 Hits@level = [0] 53 [1] 17 [2] 19 [3] 0 [4] 14 [5] 1 Hits@level+ = [0+] 104 [1+] 51 [2+] 34 [3+] 15 [4+] 15 [5+] 1 Hits/KSLOC@level+ = [0+] 55.6447 [1+] 27.2873 [2+] 18.1915 [3+] 8.02568 [4+] 8.02568 [5+] 0.535045 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.