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/unicode-screensaver-0.5.2/version.h Examining data/unicode-screensaver-0.5.2/utils/resources.h Examining data/unicode-screensaver-0.5.2/utils/yarandom.h Examining data/unicode-screensaver-0.5.2/utils/grabscreen.h Examining data/unicode-screensaver-0.5.2/utils/visual.h Examining data/unicode-screensaver-0.5.2/utils/hsv.h Examining data/unicode-screensaver-0.5.2/utils/xmu.h Examining data/unicode-screensaver-0.5.2/utils/colors.h Examining data/unicode-screensaver-0.5.2/utils/visual.c Examining data/unicode-screensaver-0.5.2/utils/utils.h Examining data/unicode-screensaver-0.5.2/utils/yarandom.c Examining data/unicode-screensaver-0.5.2/utils/usleep.h Examining data/unicode-screensaver-0.5.2/utils/vroot.h Examining data/unicode-screensaver-0.5.2/utils/resources.c Examining data/unicode-screensaver-0.5.2/utils/usleep.c Examining data/unicode-screensaver-0.5.2/unicode-names.h Examining data/unicode-screensaver-0.5.2/hacks/fps.h Examining data/unicode-screensaver-0.5.2/hacks/screenhack.h Examining data/unicode-screensaver-0.5.2/hacks/fpsI.h Examining data/unicode-screensaver-0.5.2/hacks/screenhackI.h Examining data/unicode-screensaver-0.5.2/hacks/fps.c Examining data/unicode-screensaver-0.5.2/hacks/screenhack.c Examining data/unicode-screensaver-0.5.2/unicode.c FINAL RESULTS: data/unicode-screensaver-0.5.2/hacks/fps.c:128:7: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf (st->string, (polys data/unicode-screensaver-0.5.2/hacks/fps.c:143:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (st->string + strlen(st->string), "%lu,%03lu,%03lu%s ", data/unicode-screensaver-0.5.2/hacks/fps.c:147:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (st->string + strlen(st->string), "%lu,%03lu%s ", data/unicode-screensaver-0.5.2/hacks/fps.c:150:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (st->string + strlen(st->string), "%lu%s ", polys, s); data/unicode-screensaver-0.5.2/hacks/screenhack.c:221:4: [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 (newr, progclass); data/unicode-screensaver-0.5.2/hacks/screenhack.c:222: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 (newr, oldr); data/unicode-screensaver-0.5.2/hacks/screenhack.c:736:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (version, "%s: from the XScreenSaver %s distribution (%s.)", data/unicode-screensaver-0.5.2/unicode.c:125:3: [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(name, unicode_name_get_name(nameEntry)); data/unicode-screensaver-0.5.2/utils/resources.c:47: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 (full_name, progname); data/unicode-screensaver-0.5.2/utils/resources.c:49:3: [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 (full_name, res_name); data/unicode-screensaver-0.5.2/utils/resources.c:50: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 (full_class, progclass); data/unicode-screensaver-0.5.2/utils/resources.c:52:3: [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 (full_class, res_class); data/unicode-screensaver-0.5.2/unicode.c:111:31: [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. nameEntry = &unicode_names[random() % unicode_names_length]; data/unicode-screensaver-0.5.2/utils/vroot.h:103:26: [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. const char *xss_id = getenv("XSCREENSAVER_WINDOW"); data/unicode-screensaver-0.5.2/utils/yarandom.h:15:8: [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. #undef random data/unicode-screensaver-0.5.2/utils/yarandom.h:17:8: [3] (random) drand48: 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. #undef drand48 data/unicode-screensaver-0.5.2/utils/yarandom.h:18:8: [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. #undef srandom data/unicode-screensaver-0.5.2/utils/yarandom.h:19:8: [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. #undef srand data/unicode-screensaver-0.5.2/utils/yarandom.h:31:9: [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. #define random() ya_random() data/unicode-screensaver-0.5.2/utils/yarandom.h:39:9: [3] (random) drand48: 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. #define drand48 __ERROR_use_frand_not_drand48_in_xscreensaver__ data/unicode-screensaver-0.5.2/utils/yarandom.h:40: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. #define srandom __ERROR_do_not_call_srandom_in_xscreensaver__ data/unicode-screensaver-0.5.2/utils/yarandom.h:41:9: [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. #define srand __ERROR_do_not_call_srand_in_xscreensaver__ data/unicode-screensaver-0.5.2/utils/yarandom.h:51:31: [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. ({ double tmp = ((((double) random()) * ((double) (f))) / \ data/unicode-screensaver-0.5.2/utils/yarandom.h:59:30: [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. (_frand_tmp_ = ((((double) random()) * ((double) (f))) / \ data/unicode-screensaver-0.5.2/hacks/fps.c:61:3: [2] (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). Risk is low because the source is a constant string. strcpy (st->string, "FPS: ... "); data/unicode-screensaver-0.5.2/hacks/fps.c:141:11: [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 (st->string, "\nPolys: "); data/unicode-screensaver-0.5.2/hacks/fpsI.h:25: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[1024]; data/unicode-screensaver-0.5.2/hacks/screenhack.c:193:3: [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 (merged_options, default_options, data/unicode-screensaver-0.5.2/hacks/screenhack.c:195:3: [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 (merged_options + def_opts_size, options, data/unicode-screensaver-0.5.2/hacks/screenhack.c:205:3: [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 (merged_defaults, default_defaults, data/unicode-screensaver-0.5.2/hacks/screenhack.c:207:3: [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 (merged_defaults + def_defaults_size, defaults, data/unicode-screensaver-0.5.2/hacks/screenhack.c:340: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 win[100]; data/unicode-screensaver-0.5.2/hacks/screenhack.c:341: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 why[100]; data/unicode-screensaver-0.5.2/hacks/screenhack.c:344:5: [2] (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). Risk is low because the source is a constant string. strcpy (win, "root window"); data/unicode-screensaver-0.5.2/hacks/screenhack.c:346: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 (win, "window 0x%lx", (unsigned long) window); data/unicode-screensaver-0.5.2/hacks/screenhack.c:349: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 (why, "-window-id 0x%lx", (unsigned long) window); data/unicode-screensaver-0.5.2/hacks/screenhack.c:351:5: [2] (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). Risk is low because the source is a constant string. strcpy (why, "-root"); data/unicode-screensaver-0.5.2/hacks/screenhack.c:414: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). int fd0 = open ("/dev/null", O_RDWR); data/unicode-screensaver-0.5.2/hacks/screenhack.c:415: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). int fd1 = open ("/dev/null", O_RDWR); data/unicode-screensaver-0.5.2/hacks/screenhack.c:416: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). int fd2 = open ("/dev/null", O_RDWR); data/unicode-screensaver-0.5.2/hacks/screenhack.c:685: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 version[255]; data/unicode-screensaver-0.5.2/hacks/screenhack.c:720:35: [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. if (strlen (progname) >= 100) ((char *) progname)[100] = 0; data/unicode-screensaver-0.5.2/hacks/screenhackI.h:105:9: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. #undef bcopy data/unicode-screensaver-0.5.2/hacks/screenhackI.h:106:9: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. #define bcopy __ERROR_use_memcpy_not_bcopy_in_xscreensaver__ data/unicode-screensaver-0.5.2/unicode.c:96: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[100]; data/unicode-screensaver-0.5.2/unicode.c:124:3: [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(name,"U+%04X: ", pick); data/unicode-screensaver-0.5.2/utils/resources.c:46: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 full_name [1024], full_class [1024]; data/unicode-screensaver-0.5.2/utils/resources.c:66: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 *tmp, buf [100]; data/unicode-screensaver-0.5.2/utils/visual.c:450: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 n[10]; data/unicode-screensaver-0.5.2/utils/visual.c:460: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(n, "%3d", vi_out->colormap_size); data/unicode-screensaver-0.5.2/utils/visual.c:462:5: [2] (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). Risk is low because the source is a constant string. strcpy(n, "default"); data/unicode-screensaver-0.5.2/hacks/fps.c:143: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). sprintf (st->string + strlen(st->string), "%lu,%03lu,%03lu%s ", data/unicode-screensaver-0.5.2/hacks/fps.c:147: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). sprintf (st->string + strlen(st->string), "%lu,%03lu%s ", data/unicode-screensaver-0.5.2/hacks/fps.c:150: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). sprintf (st->string + strlen(st->string), "%lu%s ", polys, s); data/unicode-screensaver-0.5.2/hacks/fps.c:230:29: [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 (! s) s = string + strlen(string); data/unicode-screensaver-0.5.2/hacks/screenhack.c:220: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). char *newr = (char *) malloc(strlen(oldr) + strlen(progclass) + 3); data/unicode-screensaver-0.5.2/hacks/screenhack.c:220: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). char *newr = (char *) malloc(strlen(oldr) + strlen(progclass) + 3); data/unicode-screensaver-0.5.2/hacks/screenhack.c:491:9: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep (quantum); data/unicode-screensaver-0.5.2/hacks/screenhack.c:720: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). if (strlen (progname) >= 100) ((char *) progname)[100] = 0; data/unicode-screensaver-0.5.2/hacks/screenhack.c:760: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 size = strlen (sw) + (argp ? 6 : 0) + 2; data/unicode-screensaver-0.5.2/hacks/screenhack.c:787: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). int L = strlen(s); data/unicode-screensaver-0.5.2/unicode.c:136: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). (unsigned char *)name,strlen(name)); data/unicode-screensaver-0.5.2/utils/resources.c:48:3: [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 (full_name, "."); data/unicode-screensaver-0.5.2/utils/resources.c:51:3: [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 (full_class, "."); data/unicode-screensaver-0.5.2/utils/resources.c:56:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (str, (char *) value.addr, value.size); data/unicode-screensaver-0.5.2/utils/resources.c:76: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). (buf[strlen(buf)-1] == ' ' || data/unicode-screensaver-0.5.2/utils/resources.c:77: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). buf[strlen(buf)-1] == '\t')) data/unicode-screensaver-0.5.2/utils/resources.c:78: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). buf[strlen(buf)-1] = 0; data/unicode-screensaver-0.5.2/utils/resources.c:156: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). for (s2 = s + strlen(s) - 1; s2 > s; s2--) data/unicode-screensaver-0.5.2/utils/resources.c:180: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). Bool black_p = (strlen(res_class) >= 10 && data/unicode-screensaver-0.5.2/utils/resources.c:182:46: [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). res_class + strlen(res_class) - 10)); data/unicode-screensaver-0.5.2/utils/usleep.c:61:3: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep (usecs); data/unicode-screensaver-0.5.2/utils/usleep.h:17:8: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. #undef usleep data/unicode-screensaver-0.5.2/utils/usleep.h:18:9: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. #define usleep(usecs) screenhack_usleep(usecs) ANALYSIS SUMMARY: Hits = 74 Lines analyzed = 50596 in approximately 1.50 seconds (33825 lines/second) Physical Source Lines of Code (SLOC) = 49439 Hits@level = [0] 55 [1] 23 [2] 27 [3] 12 [4] 12 [5] 0 Hits@level+ = [0+] 129 [1+] 74 [2+] 51 [3+] 24 [4+] 12 [5+] 0 Hits/KSLOC@level+ = [0+] 2.60928 [1+] 1.49679 [2+] 1.03157 [3+] 0.485447 [4+] 0.242723 [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.