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/i3lock-2.13/xcb.h Examining data/i3lock-2.13/unlock_indicator.h Examining data/i3lock-2.13/i3lock.c Examining data/i3lock-2.13/randr.h Examining data/i3lock-2.13/dpi.h Examining data/i3lock-2.13/unlock_indicator.c Examining data/i3lock-2.13/randr.c Examining data/i3lock-2.13/xcb.c Examining data/i3lock-2.13/cursors.h Examining data/i3lock-2.13/i3lock.h Examining data/i3lock-2.13/dpi.c FINAL RESULTS: data/i3lock-2.13/i3lock.c:706:9: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. if (sscanf(image_raw_format, fmt, &w, &h, pixfmt) != 3) { data/i3lock-2.13/i3lock.h:11:13: [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. fprintf(stderr, "[i3lock-debug] " fmt, ##__VA_ARGS__); \ data/i3lock-2.13/i3lock.c:875: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. const char *sleep_lock_fd = getenv("XSS_SLEEP_LOCK_FD"); data/i3lock-2.13/i3lock.c:1041: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. if (getenv("WAYLAND_DISPLAY") != NULL) data/i3lock-2.13/i3lock.c:1045:17: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((o = getopt_long(argc, argv, optstring, longopts, &longoptind)) != -1) { data/i3lock-2.13/i3lock.c:1112: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(NULL)); data/i3lock-2.13/i3lock.c:1119:50: [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 ((ret = pam_set_item(pam_handle, PAM_TTY, getenv("DISPLAY"))) != PAM_SUCCESS) data/i3lock-2.13/i3lock.c:1180: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 *locale = getenv("LC_ALL"); data/i3lock-2.13/i3lock.c:1182:18: [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. locale = getenv("LC_CTYPE"); data/i3lock-2.13/i3lock.c:1184:18: [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. locale = getenv("LANG"); data/i3lock-2.13/i3lock.c:60: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 color[7] = "ffffff"; data/i3lock-2.13/i3lock.c:70: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. static char password[512]; data/i3lock-2.13/i3lock.c:391: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 buffer[128]; data/i3lock-2.13/i3lock.c:521:5: [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(password + input_position, buffer, n - 1); data/i3lock-2.13/i3lock.c:703: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 pixfmt[RAW_PIXFMT_MAXLEN + 1]; data/i3lock-2.13/i3lock.c:727:15: [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(image_path, "r"); data/i3lock-2.13/i3lock.c:795:22: [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 *png_file = fopen(image_path, "r"); data/i3lock-2.13/i3lock.c:800: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 png_header[8]; data/i3lock-2.13/i3lock.c:811:21: [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 PNG_REFERENCE_HEADER[8] = {137, 80, 78, 71, 13, 10, 26, 10}; data/i3lock-2.13/unlock_indicator.c:58: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 color[7]; data/i3lock-2.13/unlock_indicator.c:110: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 strgroups[3][3] = {{color[0], color[1], '\0'}, data/i3lock-2.13/unlock_indicator.c:205:9: [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 buf[4]; data/i3lock-2.13/xcb.c:77: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 strgroups[3][3] = {{hex[0], hex[1], '\0'}, data/i3lock-2.13/i3lock.c:180: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). explicit_bzero(password, strlen(password)); data/i3lock-2.13/i3lock.c:1069: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). if (strlen(arg) != 6 || sscanf(arg, "%06[0-9a-fA-F]", color) != 1) data/i3lock-2.13/xcb.c:41: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). xcb_intern_atom(conn, 0, strlen("_NET_WM_BYPASS_COMPOSITOR"), "_NET_WM_BYPASS_COMPOSITOR"), data/i3lock-2.13/xcb.c:169: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). strlen(name), data/i3lock-2.13/xcb.c:178: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). 2 * (strlen("i3lock") + 1), data/i3lock-2.13/xcb.c:250: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(50); data/i3lock-2.13/xcb.c:287: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(50); data/i3lock-2.13/xcb.c:381: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). xcb_intern_atom(conn, 0, strlen("_NET_ACTIVE_WINDOW"), "_NET_ACTIVE_WINDOW"), ANALYSIS SUMMARY: Hits = 31 Lines analyzed = 2646 in approximately 0.11 seconds (25013 lines/second) Physical Source Lines of Code (SLOC) = 1876 Hits@level = [0] 34 [1] 8 [2] 13 [3] 8 [4] 2 [5] 0 Hits@level+ = [0+] 65 [1+] 31 [2+] 23 [3+] 10 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 34.6482 [1+] 16.5245 [2+] 12.2601 [3+] 5.33049 [4+] 1.0661 [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.