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/libxcursor-1.2.0/src/xlib.c Examining data/libxcursor-1.2.0/src/cursor.c Examining data/libxcursor-1.2.0/src/display.c Examining data/libxcursor-1.2.0/src/library.c Examining data/libxcursor-1.2.0/src/xcursorint.h Examining data/libxcursor-1.2.0/src/file.c Examining data/libxcursor-1.2.0/include/X11/Xcursor/Xcursor.h FINAL RESULTS: data/libxcursor-1.2.0/src/display.c:149:10: [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. v = getenv ("XCURSOR_CORE"); data/libxcursor-1.2.0/src/display.c:158:10: [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. v = getenv ("XCURSOR_ANIM"); data/libxcursor-1.2.0/src/display.c:171:9: [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. v = getenv ("XCURSOR_SIZE"); data/libxcursor-1.2.0/src/display.c:214:9: [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. v = getenv ("XCURSOR_THEME"); data/libxcursor-1.2.0/src/display.c:227:9: [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. v = getenv ("XCURSOR_DITHER"); data/libxcursor-1.2.0/src/display.c:247:9: [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. v = getenv ("XCURSOR_THEME_CORE"); data/libxcursor-1.2.0/src/library.c:42:9: [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. path = getenv ("XCURSOR_PATH"); data/libxcursor-1.2.0/src/library.c:103:9: [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. home = getenv ("HOME"); data/libxcursor-1.2.0/src/xlib.c:310:6: [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 (getenv ("XCURSOR_DISCOVER")) data/libxcursor-1.2.0/include/X11/Xcursor/Xcursor.h:469: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 hash[XCURSOR_BITMAP_HASH_SIZE]); data/libxcursor-1.2.0/src/cursor.c:147:18: [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 *f = fopen ("/tmp/images", "a"); data/libxcursor-1.2.0/src/cursor.c:165:18: [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 *f = fopen ("/tmp/images", "a"); data/libxcursor-1.2.0/src/display.c:175:15: [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). info->size = atoi (v); data/libxcursor-1.2.0/src/display.c:185:12: [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). dpi = atoi (v); data/libxcursor-1.2.0/src/file.c:158: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 bytes[4]; data/libxcursor-1.2.0/src/file.c:183: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 bytes[4]; data/libxcursor-1.2.0/src/file.c:1022:9: [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). f = fopen (file, "r"); data/libxcursor-1.2.0/src/file.c:1039:9: [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). f = fopen (file, "r"); data/libxcursor-1.2.0/src/file.c:1056:9: [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). f = fopen (file, "r"); data/libxcursor-1.2.0/src/file.c:1075:9: [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). f = fopen (file, "r"); data/libxcursor-1.2.0/src/file.c:1092:9: [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). f = fopen (file, "w"); data/libxcursor-1.2.0/src/file.c:1110:9: [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). f = fopen (file, "w"); data/libxcursor-1.2.0/src/library.c:163: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 line[8192]; data/libxcursor-1.2.0/src/library.c:170:9: [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). f = fopen (full, "r"); data/libxcursor-1.2.0/src/library.c:244:7: [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). f = fopen (full, "r"); data/libxcursor-1.2.0/src/xcursorint.h:67: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 hash[XCURSOR_BITMAP_HASH_SIZE]; data/libxcursor-1.2.0/src/xlib.c:202:17: [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 unsigned char const _reverse_byte[0x100] = { data/libxcursor-1.2.0/src/xlib.c:241: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 hash[XCURSOR_BITMAP_HASH_SIZE]) data/libxcursor-1.2.0/src/xlib.c:402: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 name[8 * XCURSOR_BITMAP_HASH_SIZE]; data/libxcursor-1.2.0/src/xlib.c:416:2: [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 + 2 * i, "%02x", bmi->hash[i]); data/libxcursor-1.2.0/include/X11/Xcursor/Xcursor.h:218:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int (*read) (XcursorFile *file, unsigned char *buf, int len); data/libxcursor-1.2.0/src/file.c:163:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((*file->read) (file, bytes, 4) != 4) data/libxcursor-1.2.0/src/file.c:175:36: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (!file || !bytes || (*file->read) (file, (unsigned char *) bytes, length) != length) data/libxcursor-1.2.0/src/file.c:585:41: [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). return XCURSOR_COMMENT_HEADER_LEN + strlen (comment->comment); data/libxcursor-1.2.0/src/file.c:600:14: [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 (comment->comment); data/libxcursor-1.2.0/src/library.c:52: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). size_t pathlen = strlen (path); data/libxcursor-1.2.0/src/library.c:57:2: [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 (path, "/"); data/libxcursor-1.2.0/src/library.c:61: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). len = strlen (elt); data/libxcursor-1.2.0/src/library.c:68:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (path + pathlen, elt, len); data/libxcursor-1.2.0/src/library.c:89: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). colon = dir + strlen (dir); data/libxcursor-1.2.0/src/library.c:95: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). tcolon = theme + strlen (theme); data/libxcursor-1.2.0/src/library.c:106: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). homelen = strlen (home); data/libxcursor-1.2.0/src/library.c:137:20: [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). full = malloc (strlen (dir) + 1 + strlen (subdir) + 1 + strlen (file) + 1); data/libxcursor-1.2.0/src/library.c:137:39: [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). full = malloc (strlen (dir) + 1 + strlen (subdir) + 1 + strlen (file) + 1); data/libxcursor-1.2.0/src/library.c:137:61: [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). full = malloc (strlen (dir) + 1 + strlen (subdir) + 1 + strlen (file) + 1); data/libxcursor-1.2.0/src/library.c:183:20: [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). result = malloc (strlen (l) + 1); ANALYSIS SUMMARY: Hits = 46 Lines analyzed = 3899 in approximately 0.10 seconds (38465 lines/second) Physical Source Lines of Code (SLOC) = 2987 Hits@level = [0] 10 [1] 16 [2] 21 [3] 9 [4] 0 [5] 0 Hits@level+ = [0+] 56 [1+] 46 [2+] 30 [3+] 9 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 18.7479 [1+] 15.4001 [2+] 10.0435 [3+] 3.01306 [4+] 0 [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.