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/swaybg-1.0/background-image.c Examining data/swaybg-1.0/cairo.c Examining data/swaybg-1.0/include/background-image.h Examining data/swaybg-1.0/include/cairo.h Examining data/swaybg-1.0/include/log.h Examining data/swaybg-1.0/include/pool-buffer.h Examining data/swaybg-1.0/log.c Examining data/swaybg-1.0/main.c Examining data/swaybg-1.0/pool-buffer.c FINAL RESULTS: data/swaybg-1.0/include/log.h:19:58: [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. #define _ATTRIB_PRINTF(start, end) __attribute__((format(printf, start, end))) data/swaybg-1.0/log.c:51:2: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, fmt, args); data/swaybg-1.0/main.c:422:7: [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. c = getopt_long(argc, argv, "c:hi:m:o:v", long_options, &option_index); data/swaybg-1.0/pool-buffer.c:28:21: [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 *path = getenv("XDG_RUNTIME_DIR"); data/swaybg-1.0/log.c:38: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 buffer[26]; data/swaybg-1.0/pool-buffer.c:42:11: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). int fd = mkstemp(*name); data/swaybg-1.0/main.c:23: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). int len = strlen(color); data/swaybg-1.0/main.c:30:6: [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(color) == 6) { data/swaybg-1.0/main.c:77: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). int len = strlen(color); data/swaybg-1.0/main.c:256:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(output->identifier, description, length); data/swaybg-1.0/pool-buffer.c:34: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). size_t name_size = strlen(template) + 1 + strlen(path) + 1; data/swaybg-1.0/pool-buffer.c:34:44: [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 name_size = strlen(template) + 1 + strlen(path) + 1; ANALYSIS SUMMARY: Hits = 12 Lines analyzed = 1109 in approximately 0.05 seconds (22474 lines/second) Physical Source Lines of Code (SLOC) = 947 Hits@level = [0] 10 [1] 6 [2] 2 [3] 2 [4] 2 [5] 0 Hits@level+ = [0+] 22 [1+] 12 [2+] 6 [3+] 4 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 23.2313 [1+] 12.6716 [2+] 6.3358 [3+] 4.22386 [4+] 2.11193 [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.