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/xcb-util-cursor-0.1.1/cursor/shape_to_id.c Examining data/xcb-util-cursor-0.1.1/cursor/parse_cursor_file.c Examining data/xcb-util-cursor-0.1.1/cursor/cursor.h Examining data/xcb-util-cursor-0.1.1/cursor/load_cursor.c Examining data/xcb-util-cursor-0.1.1/cursor/xcb_cursor.h Examining data/xcb-util-cursor-0.1.1/cursor/cursor.c FINAL RESULTS: data/xcb-util-cursor-0.1.1/cursor/cursor.c:103: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. if ((env = getenv("XCURSOR_SIZE")) != NULL) data/xcb-util-cursor-0.1.1/cursor/load_cursor.c:49:19: [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. c->path = getenv("XCURSOR_PATH"); data/xcb-util-cursor-0.1.1/cursor/load_cursor.c:137:24: [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 ((c->home = getenv("HOME")) == NULL) data/xcb-util-cursor-0.1.1/cursor/cursor.c:104:16: [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). return atoi(env); data/xcb-util-cursor-0.1.1/cursor/cursor.c:107:16: [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). return atoi(c->rm[RM_XCURSOR_SIZE]); data/xcb-util-cursor-0.1.1/cursor/cursor.c:110:25: [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). const int dpi = atoi(c->rm[RM_XFT_DPI]); data/xcb-util-cursor-0.1.1/cursor/cursor.h:63: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 *rm[RM_MAX]; data/xcb-util-cursor-0.1.1/cursor/load_cursor.c:72: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/xcb-util-cursor-0.1.1/cursor/load_cursor.c:79: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/xcb-util-cursor-0.1.1/cursor/load_cursor.c:158: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). fd = open(full, O_RDONLY); data/xcb-util-cursor-0.1.1/cursor/cursor.c:149: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). xcb_open_font(conn, c->cursor_font, strlen("cursor"), "cursor"); data/xcb-util-cursor-0.1.1/cursor/load_cursor.c:92: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). result = malloc (strlen (l)); data/xcb-util-cursor-0.1.1/cursor/load_cursor.c:144:51: [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). const int pathlen = (sep ? (sep - path) : strlen(path)); data/xcb-util-cursor-0.1.1/cursor/parse_cursor_file.c:89:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return read(fd, buf, count) == count; data/xcb-util-cursor-0.1.1/cursor/shape_to_id.c:525:52: [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). struct shape_mapping *mapping = in_word_set(name, strlen(name)); ANALYSIS SUMMARY: Hits = 15 Lines analyzed = 1473 in approximately 0.08 seconds (18699 lines/second) Physical Source Lines of Code (SLOC) = 1015 Hits@level = [0] 0 [1] 5 [2] 7 [3] 3 [4] 0 [5] 0 Hits@level+ = [0+] 15 [1+] 15 [2+] 10 [3+] 3 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 14.7783 [1+] 14.7783 [2+] 9.85222 [3+] 2.95567 [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.