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/xkbind-2010.05.20/common.h Examining data/xkbind-2010.05.20/xkbind.c FINAL RESULTS: data/xkbind-2010.05.20/common.h:45:11: [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). # define strcpy(dest, src) bcopy((src), (dest), 1 + strlen(src)) data/xkbind-2010.05.20/common.h:47:13: [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). # error no strcpy() or bcopy() data/xkbind-2010.05.20/xkbind.c:343:2: [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(s, prefix); data/xkbind-2010.05.20/xkbind.c:344:2: [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(s, (const char *)p_tp->value); data/xkbind-2010.05.20/xkbind.c:489:3: [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, msg, app_name, VERSION, EMAIL); data/xkbind-2010.05.20/xkbind.c:508: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(buf, p_str); data/xkbind-2010.05.20/xkbind.c:510: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(buf, user_rc_file); data/xkbind-2010.05.20/xkbind.c:539: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(buf, app_def_dir); data/xkbind-2010.05.20/xkbind.c:542: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(buf, app_name); data/xkbind-2010.05.20/xkbind.c:613:14: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. if(!name2) sprintf(buf, "%s.%s", app_name, name1); data/xkbind-2010.05.20/xkbind.c:614:8: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. else sprintf(buf, "%s.%s.%s", app_name, name1, name2); data/xkbind-2010.05.20/xkbind.c:615: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(class, buf); data/xkbind-2010.05.20/xkbind.c:622: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(ptr, def_value); data/xkbind-2010.05.20/xkbind.c:676:2: [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, msg, command); data/xkbind-2010.05.20/xkbind.c:501: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. p_str = getenv("HOME"); data/xkbind-2010.05.20/common.h:45:29: [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 strcpy(dest, src) bcopy((src), (dest), 1 + strlen(src)) data/xkbind-2010.05.20/common.h:47:25: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. # error no strcpy() or bcopy() data/xkbind-2010.05.20/xkbind.c:76: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 *group_labels[XKB_MAX_GROUP+1]; data/xkbind-2010.05.20/xkbind.c:564: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 buf[32]; data/xkbind-2010.05.20/xkbind.c:573: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 buf[16]; data/xkbind-2010.05.20/xkbind.c:619:4: [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(ptr, xv.addr, xv.size); data/xkbind-2010.05.20/xkbind.c:886:12: [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). if((i = open("/dev/null", O_RDWR)) != -1) { /* stdin */ data/xkbind-2010.05.20/common.h:45:54: [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). # define strcpy(dest, src) bcopy((src), (dest), 1 + strlen(src)) data/xkbind-2010.05.20/xkbind.c:335:18: [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). p_tp->nitems += strlen(prefix); data/xkbind-2010.05.20/xkbind.c:503: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). l = strlen(p_str); data/xkbind-2010.05.20/xkbind.c:506:18: [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 = malloc(l+strlen(user_rc_file)+2); data/xkbind-2010.05.20/xkbind.c:536: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). l = strlen(app_def_dir); data/xkbind-2010.05.20/xkbind.c:537: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). buf = malloc(l+strlen(app_name)+2); data/xkbind-2010.05.20/xkbind.c:541: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). l = strlen(buf); data/xkbind-2010.05.20/xkbind.c:607: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(app_name) + strlen(name1) + 2; data/xkbind-2010.05.20/xkbind.c:607: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). len = strlen(app_name) + strlen(name1) + 2; data/xkbind-2010.05.20/xkbind.c:608: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). if(name2) len += strlen(name2) + 1; data/xkbind-2010.05.20/xkbind.c:621: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). } else if (ptr=malloc(strlen(def_value)+1)) data/xkbind-2010.05.20/xkbind.c:883:4: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(0); ANALYSIS SUMMARY: Hits = 34 Lines analyzed = 954 in approximately 0.06 seconds (16879 lines/second) Physical Source Lines of Code (SLOC) = 732 Hits@level = [0] 25 [1] 12 [2] 7 [3] 1 [4] 14 [5] 0 Hits@level+ = [0+] 59 [1+] 34 [2+] 22 [3+] 15 [4+] 14 [5+] 0 Hits/KSLOC@level+ = [0+] 80.6011 [1+] 46.4481 [2+] 30.0546 [3+] 20.4918 [4+] 19.1257 [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.