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/xpenguins-2.2/src/xpenguins_config.c Examining data/xpenguins-2.2/src/xpenguins_core.c Examining data/xpenguins-2.2/src/toon_associate.c Examining data/xpenguins-2.2/src/toon_draw.c Examining data/xpenguins-2.2/src/toon_globals.c Examining data/xpenguins-2.2/src/toon_query.c Examining data/xpenguins-2.2/src/toon_set.c Examining data/xpenguins-2.2/src/toon_core.c Examining data/xpenguins-2.2/src/toon_end.c Examining data/xpenguins-2.2/src/toon_init.c Examining data/xpenguins-2.2/src/toon_root.c Examining data/xpenguins-2.2/src/toon_signal.c Examining data/xpenguins-2.2/src/toon.h Examining data/xpenguins-2.2/src/xpenguins.h Examining data/xpenguins-2.2/src/xpenguins_theme.c Examining data/xpenguins-2.2/src/main.c FINAL RESULTS: data/xpenguins-2.2/src/main.c:451:4: [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. printf(PKGDATADIR "\n"); data/xpenguins-2.2/src/xpenguins.h:68:25: [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. #define XPENGUINS_DEBUG fprintf(stderr, __FILE__ ": line %d\n", __LINE__) data/xpenguins-2.2/src/xpenguins_theme.c:505:39: [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. #define WARNING if(xpenguins_verbose) fprintf data/xpenguins-2.2/src/main.c:286:7: [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(getpid() ^ time(NULL)); data/xpenguins-2.2/src/main.c:468:47: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. config_dir, XPENGUINS_THEME_DIRECTORY, getenv("HOME"), data/xpenguins-2.2/src/toon_init.c:34:33: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (display_name == NULL && getenv("DISPLAY") == NULL) data/xpenguins-2.2/src/xpenguins_core.c:127:5: [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(time((long *) NULL)); data/xpenguins-2.2/src/xpenguins_theme.c:152:16: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *home = getenv("HOME"); data/xpenguins-2.2/src/xpenguins_theme.c:337:16: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *home = getenv("HOME"); data/xpenguins-2.2/src/main.c:105: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). npenguins = atoi(argv[n]); data/xpenguins-2.2/src/main.c:127:18: [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). sleep_usec=1000*atoi(argv[n]); data/xpenguins-2.2/src/main.c:520:20: [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). FILE *loadfile = fopen("/proc/loadavg", "r"); data/xpenguins-2.2/src/toon.h:147: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. extern char toon_error_message[TOON_MESSAGE_LENGTH]; data/xpenguins-2.2/src/toon.h:148: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. extern char toon_message[TOON_MESSAGE_LENGTH]; data/xpenguins-2.2/src/toon_globals.c:44: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 toon_error_message[TOON_MESSAGE_LENGTH] = ""; data/xpenguins-2.2/src/toon_globals.c:45: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 toon_message[TOON_MESSAGE_LENGTH] = ""; data/xpenguins-2.2/src/xpenguins_theme.c:432: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 word[MAX_STRING_LENGTH]; data/xpenguins-2.2/src/xpenguins_theme.c:464: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). config = fopen(file_name, "r"); data/xpenguins-2.2/src/xpenguins_theme.c:501:53: [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). #define GET_INT(dest) if (NEXT_WORD() > 0) { dest = atoi(word); } data/xpenguins-2.2/src/xpenguins_theme.c:503:41: [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). if (NEXT_WORD() > 0 && (tmp_int = atoi(word)) >= 0) { dest = tmp_int; } data/xpenguins-2.2/src/xpenguins_theme.c:855: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 word[MAX_STRING_LENGTH]; data/xpenguins-2.2/src/xpenguins_theme.c:856: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 string[MAX_STRING_LENGTH]; data/xpenguins-2.2/src/xpenguins_theme.c:891:16: [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). about_file = fopen(file_name, "r"); data/xpenguins-2.2/src/toon_init.c:35:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy(toon_error_message, _("DISPLAY environment variable not set"), data/xpenguins-2.2/src/toon_init.c:38:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy(toon_error_message, _("Can't open display"), data/xpenguins-2.2/src/toon_init.c:97: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). int len = strlen(toon_message); data/xpenguins-2.2/src/xpenguins_config.c:35:10: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ch = fgetc(file); data/xpenguins-2.2/src/xpenguins_config.c:42:12: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((ch = fgetc(file)) == EOF) { data/xpenguins-2.2/src/xpenguins_config.c:61:10: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ch = fgetc(file); data/xpenguins-2.2/src/xpenguins_config.c:84:10: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ch = fgetc(file); data/xpenguins-2.2/src/xpenguins_config.c:105:7: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ch = fgetc(file); data/xpenguins-2.2/src/xpenguins_config.c:109:10: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ch = fgetc(file); data/xpenguins-2.2/src/xpenguins_theme.c:167: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). string_length = strlen(home) + strlen(home_root) data/xpenguins-2.2/src/xpenguins_theme.c:167:36: [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). string_length = strlen(home) + strlen(home_root) data/xpenguins-2.2/src/xpenguins_theme.c:168:9: [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(themes) + 2 + strlen(config) + 1; data/xpenguins-2.2/src/xpenguins_theme.c:168:30: [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(themes) + 2 + strlen(config) + 1; data/xpenguins-2.2/src/xpenguins_theme.c:185:19: [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). string_length = strlen(xpenguins_directory) + strlen(themes) + 2 data/xpenguins-2.2/src/xpenguins_theme.c:185:49: [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). string_length = strlen(xpenguins_directory) + strlen(themes) + 2 data/xpenguins-2.2/src/xpenguins_theme.c:186: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). + strlen(config) + 1; data/xpenguins-2.2/src/xpenguins_theme.c:209:25: [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). int file_path_len = strlen(file_path); data/xpenguins-2.2/src/xpenguins_theme.c:210: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). char *dir_name = file_path + file_path_len - strlen(config); data/xpenguins-2.2/src/xpenguins_theme.c:280:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(list + list_len - dir_name_len - 1, dir_name, dir_name_len); data/xpenguins-2.2/src/xpenguins_theme.c:347:19: [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). root_length = strlen(home) + strlen(home_root) + strlen(themes) + 1; data/xpenguins-2.2/src/xpenguins_theme.c:347:34: [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). root_length = strlen(home) + strlen(home_root) + strlen(themes) + 1; data/xpenguins-2.2/src/xpenguins_theme.c:347:54: [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). root_length = strlen(home) + strlen(home_root) + strlen(themes) + 1; data/xpenguins-2.2/src/xpenguins_theme.c:348:35: [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). string_length = root_length + strlen(name) + strlen(config) + 1; data/xpenguins-2.2/src/xpenguins_theme.c:348: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). string_length = root_length + strlen(name) + strlen(config) + 1; data/xpenguins-2.2/src/xpenguins_theme.c:366: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). config_path[string_length-strlen(config)-1] = '\0'; data/xpenguins-2.2/src/xpenguins_theme.c:373:17: [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). root_length = strlen(xpenguins_directory) + strlen(themes) + 1; data/xpenguins-2.2/src/xpenguins_theme.c:373:47: [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). root_length = strlen(xpenguins_directory) + strlen(themes) + 1; data/xpenguins-2.2/src/xpenguins_theme.c:374: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). string_length = root_length + strlen(name) + strlen(config) + 1; data/xpenguins-2.2/src/xpenguins_theme.c:374:48: [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). string_length = root_length + strlen(name) + strlen(config) + 1; data/xpenguins-2.2/src/xpenguins_theme.c:396:31: [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). config_path[string_length-strlen(config)-1] = '\0'; data/xpenguins-2.2/src/xpenguins_theme.c:451: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). max_file_name_length = strlen(file_name) + 1 + MAX_STRING_LENGTH; data/xpenguins-2.2/src/xpenguins_theme.c:460: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). file_base = file_name + strlen(file_name); data/xpenguins-2.2/src/xpenguins_theme.c:844:8: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(list + offsets[index], string, string_length + 1); \ data/xpenguins-2.2/src/xpenguins_theme.c:866:22: [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). int about_length = strlen(about); data/xpenguins-2.2/src/xpenguins_theme.c:875:22: [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). theme_dir_length = strlen(theme_dir); ANALYSIS SUMMARY: Hits = 58 Lines analyzed = 4373 in approximately 0.13 seconds (32418 lines/second) Physical Source Lines of Code (SLOC) = 3288 Hits@level = [0] 68 [1] 35 [2] 14 [3] 6 [4] 3 [5] 0 Hits@level+ = [0+] 126 [1+] 58 [2+] 23 [3+] 9 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 38.3212 [1+] 17.6399 [2+] 6.99513 [3+] 2.73723 [4+] 0.912409 [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.