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/xless-1.7/regexp/regerror.c Examining data/xless-1.7/regexp/regexp.c Examining data/xless-1.7/regexp/regsub.c Examining data/xless-1.7/regexp/regexp.h Examining data/xless-1.7/regexp/regmagic.h Examining data/xless-1.7/actions.c Examining data/xless-1.7/help.c Examining data/xless-1.7/popup.c Examining data/xless-1.7/version.h Examining data/xless-1.7/widgdump.c Examining data/xless-1.7/callbacks.c Examining data/xless-1.7/functions.c Examining data/xless-1.7/init.c Examining data/xless-1.7/main.c Examining data/xless-1.7/util.c Examining data/xless-1.7/window.c Examining data/xless-1.7/xless.h FINAL RESULTS: data/xless-1.7/callbacks.c:46:12: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. extern int system __P((const char *)); data/xless-1.7/callbacks.c:122:5: [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(cmd, editor); data/xless-1.7/callbacks.c:125:5: [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(cmd, editor); data/xless-1.7/callbacks.c:128: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(cmd, wi->file); data/xless-1.7/callbacks.c:130:3: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. system(cmd); data/xless-1.7/callbacks.c:521: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(cmd, resources.printCmd); data/xless-1.7/callbacks.c:523: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(cmd, printfile); data/xless-1.7/callbacks.c:524:3: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. system(cmd); data/xless-1.7/help.c:74:5: [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(hin, progname); data/xless-1.7/init.c:604:5: [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(namePrefix, progname); data/xless-1.7/init.c:631: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(namestr, namePrefix); data/xless-1.7/init.c:632: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(namestr, filename); data/xless-1.7/regexp/regexp.c:1285:10: [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). (void) strcat(buf, p); data/xless-1.7/util.c:150: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(data.errmsg, msgpart); data/xless-1.7/util.c:151: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(data.errmsg, filename); data/xless-1.7/util.c:212:7: [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(bptr, pw->pw_dir); data/xless-1.7/util.c:213:7: [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(bptr, end); data/xless-1.7/callbacks.c:45:14: [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. extern char *getenv __P((const char *)); data/xless-1.7/callbacks.c:110:17: [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 ((editor = getenv("VISUAL")) == NULL && data/xless-1.7/callbacks.c:111:17: [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. (editor = getenv("EDITOR")) == NULL) data/xless-1.7/callbacks.c:496:17: [3] (tmpfile) tmpnam: Temporary file race condition (CWE-377). printfile = tmpnam(0); data/xless-1.7/callbacks.c:124:5: [2] (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). Risk is low because the source is a constant string. strcpy(cmd, "xterm -e "); data/xless-1.7/callbacks.c:143:8: [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(wi->file, O_RDONLY); data/xless-1.7/callbacks.c:385:8: [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(filename, O_RDONLY); data/xless-1.7/callbacks.c:497:12: [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 = fopen(printfile, "w"); data/xless-1.7/help.c:61:8: [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(resources.helpFile, O_RDONLY); data/xless-1.7/help.c:75:5: [2] (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 string. strcat(hin, ":help"); data/xless-1.7/init.c:118: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 buffer[BUFSIZ]; data/xless-1.7/init.c:474:5: [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(geomPosition, "%+d%+d", geomX, geomY); data/xless-1.7/regexp/regexp.c:1209: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. static char buf[50]; data/xless-1.7/regexp/regexp.c:1253:3: [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(buf+strlen(buf), "OPEN%d", OP(op)-OPEN); data/xless-1.7/regexp/regexp.c:1265:3: [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(buf+strlen(buf), "CLOSE%d", OP(op)-CLOSE); data/xless-1.7/regexp/regexp.h:9: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 *startp[NSUBEXP]; data/xless-1.7/regexp/regexp.h:10: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 *endp[NSUBEXP]; data/xless-1.7/regexp/regexp.h:15: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 program[1]; /* Unwarranted chumminess with compiler. */ data/xless-1.7/util.c:169: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 username[USERNAMELEN], *bptr = username; data/xless-1.7/window.c:122: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 message[64]; data/xless-1.7/window.c:126:7: [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(message, "Can't have more than %d windows!", data/xless-1.7/window.c:149:10: [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(filename, O_RDONLY); data/xless-1.7/callbacks.c:117:13: [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). cmdlen += strlen(editor) + 1 + strlen(wi->file) + 2; data/xless-1.7/callbacks.c:117: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). cmdlen += strlen(editor) + 1 + strlen(wi->file) + 2; data/xless-1.7/callbacks.c:127:3: [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(cmd, " "); data/xless-1.7/callbacks.c:129:3: [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(cmd, "&"); data/xless-1.7/callbacks.c:223:13: [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(str); data/xless-1.7/callbacks.c:295:9: [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(wi->searchBuf); data/xless-1.7/callbacks.c:519:38: [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). cmd = (char *)XtMalloc((Cardinal )(strlen(resources.printCmd) + 1 + data/xless-1.7/callbacks.c:520:10: [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(printfile) + 1)); data/xless-1.7/callbacks.c:522:3: [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(cmd, " "); data/xless-1.7/help.c:73:40: [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). hin = (char *)XtMalloc((Cardinal )(strlen(progname) + 6)); data/xless-1.7/init.c:124:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((nbytes = read(*source, buffer, (size_t )BUFSIZ)) == -1) { data/xless-1.7/init.c:137:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(bottom, buffer, (size_t )nbytes); data/xless-1.7/init.c:193:3: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(fd, data, (size_t )fileinfo.st_size); data/xless-1.7/init.c:254:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((sz = read(fd, where, (size_t )XLESS_MEMORY_CHUNK)) != 0) { data/xless-1.7/init.c:603: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). namePrefix = XtMalloc((Cardinal )(strlen(progname) + 2)); data/xless-1.7/init.c:605:5: [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(namePrefix, ":"); data/xless-1.7/init.c:610: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). prefixlen = strlen(namePrefix); data/xless-1.7/init.c:622:24: [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). newlen = prefixlen + strlen(filename) + 1; data/xless-1.7/main.c:154: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). tmp = XtMalloc((Cardinal )(strlen((char *)fromVal->addr) + 1)); data/xless-1.7/main.c:193:9: [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(str); data/xless-1.7/regexp/regexp.c:271:32: [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 (OP(scan) == EXACTLY && strlen(OPERAND(scan)) >= len) { data/xless-1.7/regexp/regexp.c:273: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). len = strlen(OPERAND(scan)); data/xless-1.7/regexp/regexp.c:942:11: [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(opnd); data/xless-1.7/regexp/regexp.c:1100:11: [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). count = strlen(scan); data/xless-1.7/regexp/regexp.c:1211:9: [1] (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). Risk is low because the source is a constant character. (void) strcpy(buf, ":"); data/xless-1.7/regexp/regexp.c:1253:15: [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). sprintf(buf+strlen(buf), "OPEN%d", OP(op)-OPEN); data/xless-1.7/regexp/regexp.c:1265:15: [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). sprintf(buf+strlen(buf), "CLOSE%d", OP(op)-CLOSE); data/xless-1.7/regexp/regsub.c:47:15: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). extern char *strncpy(); data/xless-1.7/regexp/regsub.c:74:11: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void) strncpy(dst, prog->startp[no], len); data/xless-1.7/util.c:148:46: [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). data.errmsg = (char *)XtMalloc((Cardinal )(strlen(msgpart) + data/xless-1.7/util.c:149:11: [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(filename) + 1)); data/xless-1.7/util.c:176:22: [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). end = filename + strlen(filename); data/xless-1.7/util.c:193:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(bptr, filename + 1, (size_t )len); data/xless-1.7/util.c:208: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). bptr = (char *)XtMalloc((Cardinal )(strlen(pw->pw_dir) + strlen(end) + 1)); data/xless-1.7/util.c:208:62: [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). bptr = (char *)XtMalloc((Cardinal )(strlen(pw->pw_dir) + strlen(end) + 1)); ANALYSIS SUMMARY: Hits = 74 Lines analyzed = 4560 in approximately 0.12 seconds (36863 lines/second) Physical Source Lines of Code (SLOC) = 3133 Hits@level = [0] 35 [1] 35 [2] 18 [3] 4 [4] 17 [5] 0 Hits@level+ = [0+] 109 [1+] 74 [2+] 39 [3+] 21 [4+] 17 [5+] 0 Hits/KSLOC@level+ = [0+] 34.7909 [1+] 23.6195 [2+] 12.4481 [3+] 6.70284 [4+] 5.42611 [5+] 0 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.