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/bmake-20200710/buf.c Examining data/bmake-20200710/buf.h Examining data/bmake-20200710/compat.c Examining data/bmake-20200710/cond.c Examining data/bmake-20200710/dir.c Examining data/bmake-20200710/dir.h Examining data/bmake-20200710/dirname.c Examining data/bmake-20200710/filemon/filemon.h Examining data/bmake-20200710/filemon/filemon_dev.c Examining data/bmake-20200710/filemon/filemon_ktrace.c Examining data/bmake-20200710/for.c Examining data/bmake-20200710/getopt.c Examining data/bmake-20200710/hash.c Examining data/bmake-20200710/hash.h Examining data/bmake-20200710/job.c Examining data/bmake-20200710/job.h Examining data/bmake-20200710/lst.h Examining data/bmake-20200710/lst.lib/lstAppend.c Examining data/bmake-20200710/lst.lib/lstAtEnd.c Examining data/bmake-20200710/lst.lib/lstAtFront.c Examining data/bmake-20200710/lst.lib/lstClose.c Examining data/bmake-20200710/lst.lib/lstConcat.c Examining data/bmake-20200710/lst.lib/lstDatum.c Examining data/bmake-20200710/lst.lib/lstDeQueue.c Examining data/bmake-20200710/lst.lib/lstDestroy.c Examining data/bmake-20200710/lst.lib/lstDupl.c Examining data/bmake-20200710/lst.lib/lstEnQueue.c Examining data/bmake-20200710/lst.lib/lstFind.c Examining data/bmake-20200710/lst.lib/lstFindFrom.c Examining data/bmake-20200710/lst.lib/lstFirst.c Examining data/bmake-20200710/lst.lib/lstForEach.c Examining data/bmake-20200710/lst.lib/lstForEachFrom.c Examining data/bmake-20200710/lst.lib/lstInit.c Examining data/bmake-20200710/lst.lib/lstInsert.c Examining data/bmake-20200710/lst.lib/lstInt.h Examining data/bmake-20200710/lst.lib/lstIsAtEnd.c Examining data/bmake-20200710/lst.lib/lstIsEmpty.c Examining data/bmake-20200710/lst.lib/lstLast.c Examining data/bmake-20200710/lst.lib/lstMember.c Examining data/bmake-20200710/lst.lib/lstNext.c Examining data/bmake-20200710/lst.lib/lstOpen.c Examining data/bmake-20200710/lst.lib/lstPrev.c Examining data/bmake-20200710/lst.lib/lstRemove.c Examining data/bmake-20200710/lst.lib/lstReplace.c Examining data/bmake-20200710/lst.lib/lstSucc.c Examining data/bmake-20200710/make-conf.h Examining data/bmake-20200710/make.c Examining data/bmake-20200710/make.h Examining data/bmake-20200710/make_malloc.c Examining data/bmake-20200710/make_malloc.h Examining data/bmake-20200710/meta.c Examining data/bmake-20200710/meta.h Examining data/bmake-20200710/metachar.c Examining data/bmake-20200710/metachar.h Examining data/bmake-20200710/missing/sys/cdefs.h Examining data/bmake-20200710/nonints.h Examining data/bmake-20200710/parse.c Examining data/bmake-20200710/pathnames.h Examining data/bmake-20200710/ranlib.h Examining data/bmake-20200710/realpath.c Examining data/bmake-20200710/setenv.c Examining data/bmake-20200710/sigcompat.c Examining data/bmake-20200710/sprite.h Examining data/bmake-20200710/str.c Examining data/bmake-20200710/stresep.c Examining data/bmake-20200710/strlcpy.c Examining data/bmake-20200710/strlist.c Examining data/bmake-20200710/strlist.h Examining data/bmake-20200710/suff.c Examining data/bmake-20200710/targ.c Examining data/bmake-20200710/trace.c Examining data/bmake-20200710/trace.h Examining data/bmake-20200710/util.c Examining data/bmake-20200710/var.c Examining data/bmake-20200710/wait.h Examining data/bmake-20200710/arch.c Examining data/bmake-20200710/main.c FINAL RESULTS: data/bmake-20200710/realpath.c:180:7: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. n = readlink(resolved, wbuf[idx], sizeof(wbuf[0]) - 1); data/bmake-20200710/compat.c:396:12: [4] (shell) execvp: 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. (void)execvp(av[0], (char *const *)UNCONST(av)); data/bmake-20200710/compat.c:398:12: [4] (shell) execv: 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. (void)execv(av[0], (char *const *)UNCONST(av)); data/bmake-20200710/dir.c:732: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(&file[(brace-word)+(cp-start)], end); data/bmake-20200710/hash.c:299:8: [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). (void)strcpy(e->name, p); data/bmake-20200710/job.c:350:12: [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. (void)fprintf(fp, TARG_FMT, targPrefix, gn->name) data/bmake-20200710/job.c:741:8: [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. (void)fprintf(debug_file, fmt, arg); \ data/bmake-20200710/job.c:743:10: [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. (void)fprintf(job->cmdFILE, fmt, arg); \ data/bmake-20200710/job.c:1464:8: [4] (shell) execv: 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. (void)execv(shellPath, argv); data/bmake-20200710/main.c:777:2: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. vsnprintf(path = buf, MAXPATHLEN, fmt, ap); data/bmake-20200710/main.c:1707:8: [4] (shell) execv: 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. (void)execv(shellPath, UNCONST(args)); data/bmake-20200710/main.c:1809:9: [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. (void)vfprintf(err_file, fmt, ap); data/bmake-20200710/main.c:1841:8: [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. (void)vfprintf(stderr, fmt, ap); data/bmake-20200710/main.c:1874:8: [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. (void)vfprintf(stderr, fmt, ap); data/bmake-20200710/meta.c:1251:4: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf(lcwd_vname, sizeof(lcwd_vname), LCWD_VNAME_FMT, pid); data/bmake-20200710/meta.c:1252:4: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf(ldir_vname, sizeof(ldir_vname), LDIR_VNAME_FMT, pid); data/bmake-20200710/meta.c:1294:8: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf(cldir, sizeof(cldir), LCWD_VNAME_FMT, child); data/bmake-20200710/meta.c:1296:8: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf(cldir, sizeof(cldir), LDIR_VNAME_FMT, child); data/bmake-20200710/parse.c:726:8: [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. (void)vfprintf(f, fmt, ap); data/bmake-20200710/util.c:255:8: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void)sprintf(pathname, data/bmake-20200710/util.c:266:8: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void)sprintf(pathname, data/bmake-20200710/util.c:278:12: [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). (void)strcpy(pathname, *pathptr != '/' ? "/" : pathptr); data/bmake-20200710/util.c:284:12: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void)sprintf(pathname, data/bmake-20200710/util.c:290:12: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void)sprintf(pathname, data/bmake-20200710/util.c:311:9: [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). (void)strcpy(cur_name_add, d->d_name); data/bmake-20200710/util.c:313:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void)sprintf(pathname, data/bmake-20200710/util.c:384:1: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. vsnprintf(char *s, size_t n, const char *fmt, va_list args) data/bmake-20200710/util.c:417:10: [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. need = vfprintf(nullfp, fmt, args); data/bmake-20200710/util.c:419:10: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. (void)vsprintf(s, fmt, args); data/bmake-20200710/util.c:428:1: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf(char *s, size_t n, const char *fmt, ...) data/bmake-20200710/util.c:434:7: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. rv = vsnprintf(s, n, fmt, ap); data/bmake-20200710/util.c:517:3: [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/bmake-20200710/getopt.c:58:1: [3] (buffer) getopt: 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. getopt(int nargc, char * const nargv[], const char *ostr) data/bmake-20200710/getopt.c:161:14: [3] (buffer) getopt: 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 ((c = getopt(argc, argv, opts)) != EOF) { data/bmake-20200710/main.c:1009:28: [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 *machine = getenv("MACHINE"); data/bmake-20200710/main.c:1011:29: [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 *machine_arch = getenv("MACHINE_ARCH"); data/bmake-20200710/main.c:1012:34: [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 *machine_multiarch = getenv("MACHINE_MULTIARCH"); data/bmake-20200710/main.c:1013: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. char *syspath = getenv("MAKESYSPATH"); data/bmake-20200710/main.c:1033:2: [3] (random) srandom: 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. srandom(rightnow.tv_sec + rightnow.tv_usec); data/bmake-20200710/main.c:1210:25: [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. makelevel = ((ep = getenv(MAKE_LEVEL_ENV)) && *ep) ? atoi(ep) : 0; data/bmake-20200710/main.c:1237:15: [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. p1 = explode(getenv("MAKEFLAGS")); data/bmake-20200710/main.c:1241:20: [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. Main_ParseArgLine(getenv("MAKE")); data/bmake-20200710/main.c:1283: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. if ((pwd = getenv("PWD")) != NULL && data/bmake-20200710/main.c:2050:22: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. } else if ((rp = realpath(pathname, resolved)) != NULL) { data/bmake-20200710/parse.c:707:11: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. dir = realpath(dir, dirbuf); data/bmake-20200710/realpath.c:67:1: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. realpath(const char * __restrict path, char * __restrict resolved) data/bmake-20200710/util.c:67:1: [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. getenv(const char *name) data/bmake-20200710/util.c:154: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. printf("%s\n", getenv(argv[1])); data/bmake-20200710/util.c:156: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. printf("%s\n", getenv(argv[1])); data/bmake-20200710/util.c:243:1: [3] (buffer) getwd: This does not protect against buffer overflows by itself, so use with caution (CWE-120, CWE-20). Use getcwd instead. getwd(char *pathname) data/bmake-20200710/util.c:348:9: [3] (buffer) getwd: This does not protect against buffer overflows by itself, so use with caution (CWE-120, CWE-20). Use getcwd instead. return getwd(path); data/bmake-20200710/var.c:402:13: [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(name)) != NULL) { data/bmake-20200710/var.c:780:7: [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. cp = getenv(MAKE_LEVEL_ENV); /* we should preserve this */ data/bmake-20200710/var.c:1819:20: [3] (random) random: 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. int rndidx = random() % (i + 1); data/bmake-20200710/arch.c:143: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 ar_name[16]; /* name */ data/bmake-20200710/arch.c:144: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 ar_date[12]; /* modification time */ data/bmake-20200710/arch.c:145: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 ar_uid[6]; /* user id */ data/bmake-20200710/arch.c:146: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 ar_gid[6]; /* group id */ data/bmake-20200710/arch.c:147: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 ar_mode[8]; /* octal file permissions */ data/bmake-20200710/arch.c:148: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 ar_size[10]; /* size in bytes */ data/bmake-20200710/arch.c:152: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 ar_fmag[2]; /* consistency check */ data/bmake-20200710/arch.c:570: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 magic[SARMAG]; data/bmake-20200710/arch.c:575: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 memName[MAXPATHLEN+1]; data/bmake-20200710/arch.c:599:6: [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 copy[AR_MAX_NAME_LEN+1]; data/bmake-20200710/arch.c:637: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). arch = fopen(archive, "r"); data/bmake-20200710/arch.c:676:6: [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(memName, arh.AR_NAME, sizeof(arh.AR_NAME)); data/bmake-20200710/arch.c:713:23: [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). unsigned int elen = atoi(&memName[sizeof(AR_EFMT1)-1]); data/bmake-20200710/arch.c:730:6: [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(Hash_GetValue(he), &arh, sizeof(struct ar_hdr)); data/bmake-20200710/arch.c:893: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 magic[SARMAG]; data/bmake-20200710/arch.c:896: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). arch = fopen(archive, mode); data/bmake-20200710/arch.c:968:23: [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). unsigned int elen = atoi(&arhPtr->AR_NAME[sizeof(AR_EFMT1)-1]); data/bmake-20200710/arch.c:969: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 ename[MAXPATHLEN + 1]; data/bmake-20200710/arch.c:1393: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 buf[sizeof(armag)-1]; data/bmake-20200710/arch.c:1396:15: [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 ((fd = open(gn->path, O_RDONLY)) == -1) data/bmake-20200710/buf.c:140: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(ptr, bytesPtr, numBytes); data/bmake-20200710/compat.c:339:15: [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 const char *shargv[5]; data/bmake-20200710/dir.c:887: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 *)UNCONST(cp))[1] = '\0'; data/bmake-20200710/dir.c:889: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 *)UNCONST(cp))[1] = sc; data/bmake-20200710/dir.c:1433: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 dirbase[MAXPATHLEN + 1], *db_end; data/bmake-20200710/dir.c:1434: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 try[MAXPATHLEN + 1], *try_end; data/bmake-20200710/dirname.c:100: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(buf, path, buflen); data/bmake-20200710/dirname.c:109: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 result[PATH_MAX]; data/bmake-20200710/filemon/filemon_dev.c:73:23: [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). for (i = 0; (F->fd = open(_PATH_FILEMON, O_RDWR|O_CLOEXEC)) == -1; i++) { data/bmake-20200710/filemon/filemon_ktrace.c:114: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 namei[PATH_MAX]; data/bmake-20200710/filemon/filemon_ktrace.c:115:12: [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 buf[4096]; data/bmake-20200710/filemon/filemon_ktrace.c:130: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 *path[/*npath*/]; data/bmake-20200710/for.c:110:2: [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(new_ptr, ptr, len); data/bmake-20200710/hash.h:94: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 name[1]; /* key string */ data/bmake-20200710/job.c:1213:17: [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). streamID = open(file, O_RDWR | O_CREAT, 0666); data/bmake-20200710/job.c:1520:12: [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 args[10]; /* For merged arguments */ data/bmake-20200710/job.c:1587: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 *argv[10]; /* Argument vector to shell */ data/bmake-20200710/job.c:2942: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 jobarg[64]; data/bmake-20200710/job.h:169: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 outBuf[JOB_BUFSIZE + 1]; data/bmake-20200710/main.c:208: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 objdir[MAXPATHLEN + 1]; /* where we chdir'ed to */ data/bmake-20200710/main.c:209: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 curdir[MAXPATHLEN + 1]; /* Startup directory */ data/bmake-20200710/main.c:358: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(fname, modules, len + 1); data/bmake-20200710/main.c:362:17: [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). debug_file = fopen(fname, mode); data/bmake-20200710/main.c:439: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 found_path[MAXPATHLEN + 1]; /* for searching for sys.mk */ data/bmake-20200710/main.c:771: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 buf[MAXPATHLEN + 1]; data/bmake-20200710/main.c:772: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 buf2[MAXPATHLEN + 1]; data/bmake-20200710/main.c:862: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 dir[MAXPATHLEN]; data/bmake-20200710/main.c:863: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 str[2 * MAXPATHLEN]; data/bmake-20200710/main.c:922:4: [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 tmp[128]; data/bmake-20200710/main.c:1005: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 mdpath[MAXPATHLEN]; data/bmake-20200710/main.c:1018: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 found_path[MAXPATHLEN + 1]; /* for searching for sys.mk */ data/bmake-20200710/main.c:1081:13: [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 machine_arch_buf[sizeof(utsname.machine)]; data/bmake-20200710/main.c:1208:6: [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 tmp[64], *ep; data/bmake-20200710/main.c:1210:59: [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). makelevel = ((ep = getenv(MAKE_LEVEL_ENV)) && *ep) ? atoi(ep) : 0; data/bmake-20200710/main.c:1221: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 pn[1024]; data/bmake-20200710/main.c:1592:9: [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(path, O_RDONLY); data/bmake-20200710/main.c:1603:9: [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(path, O_RDONLY); data/bmake-20200710/main.c:1609:9: [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(fname, O_RDONLY); data/bmake-20200710/main.c:1618:22: [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 (!name || (fd = open(name, O_RDONLY)) == -1) { data/bmake-20200710/main.c:1655:11: [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. const char *args[4]; /* Args for invoking the shell */ data/bmake-20200710/main.c:1725:6: [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 result[BUFSIZ]; data/bmake-20200710/main.c:2100: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 tmp[64]; data/bmake-20200710/main.c:2146: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 tmp[64]; data/bmake-20200710/main.c:2196: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 tfile[MAXPATHLEN]; data/bmake-20200710/main.c:2208:15: [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). if ((fd = mkstemp(tfile)) < 0) data/bmake-20200710/main.c:2267: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 tmp[64]; data/bmake-20200710/make.h:233: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 cohort_num[8]; /* #n for this cohort */ data/bmake-20200710/make.h:446:40: [2] (race) vfork: On some old systems, vfork() permits race conditions, and it's very difficult to use correctly (CWE-362). Use fork() instead. #define vFork() ((getpid() == myPid) ? vfork() : fork()) data/bmake-20200710/make_malloc.c:82:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. return memcpy(p, str, len); data/bmake-20200710/make_malloc.c:102:2: [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(p, str, len); data/bmake-20200710/meta.c:166: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 buf[BUFSIZ]; data/bmake-20200710/meta.c:246: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 buf[MAXPATHLEN]; data/bmake-20200710/meta.c:466: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 buf[MAXPATHLEN]; data/bmake-20200710/meta.c:467: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 objdir[MAXPATHLEN]; data/bmake-20200710/meta.c:473: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 *p[5]; /* >= possible uses */ data/bmake-20200710/meta.c:517:18: [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). if ((mf.fp = fopen(fname, "w")) == NULL) data/bmake-20200710/meta.c:780: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 cwd[MAXPATHLEN]; data/bmake-20200710/meta.c:1000: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 fname[MAXPATHLEN]; data/bmake-20200710/meta.c:1088:12: [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 cwd[MAXPATHLEN]; data/bmake-20200710/meta.c:1089: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 lcwd_vname[64]; data/bmake-20200710/meta.c:1090: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 ldir_vname[64]; data/bmake-20200710/meta.c:1091: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 lcwd[MAXPATHLEN]; data/bmake-20200710/meta.c:1092: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 latestdir[MAXPATHLEN]; data/bmake-20200710/meta.c:1093: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 fname[MAXPATHLEN]; data/bmake-20200710/meta.c:1094: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 fname1[MAXPATHLEN]; data/bmake-20200710/meta.c:1095: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 fname2[MAXPATHLEN]; data/bmake-20200710/meta.c:1096: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 fname3[MAXPATHLEN]; data/bmake-20200710/meta.c:1108: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 *pa[4]; /* >= possible uses */ data/bmake-20200710/meta.c:1142: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). if ((fp = fopen(fname, "r")) != NULL) { data/bmake-20200710/meta.c:1241:13: [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). pid = atoi(p); data/bmake-20200710/meta.c:1289:4: [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 cldir[64]; data/bmake-20200710/meta.c:1292:12: [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). child = atoi(p); data/bmake-20200710/meta.c:1445:4: [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 *sdirs[4]; data/bmake-20200710/meta.c:1693: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 buf[BUFSIZ+1]; data/bmake-20200710/meta.h:35: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 meta_fname[MAXPATHLEN]; data/bmake-20200710/metachar.c:54:10: [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 _metachar[128] = { data/bmake-20200710/parse.c:502: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(path, O_RDONLY); data/bmake-20200710/parse.c:544: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(b, lf->buf, lf->len++); data/bmake-20200710/parse.c:688: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 dirbuf[MAXPATHLEN+1]; data/bmake-20200710/parse.c:1002: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 wait_src[16]; data/bmake-20200710/parse.c:2277: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(fullname, O_RDONLY); data/bmake-20200710/parse.c:2410:2: [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(dirname, filename, len); data/bmake-20200710/realpath.c:72: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 *p, wbuf[2][MAXPATHLEN], *fres; data/bmake-20200710/realpath.c:163:2: [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(&p[1], path, data/bmake-20200710/realpath.c:193:3: [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(&wbuf[idx][n], q, len + 1); data/bmake-20200710/setenv.c:119:4: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. bcopy(environ, P, cnt * sizeof(char *)); data/bmake-20200710/sigcompat.c:213:2: [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((char *) ma, (char *) ss, sizeof(sigset_t)); data/bmake-20200710/sigcompat.c:223:2: [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((char *) ss, (char *) m, sizeof(MASK_T)); data/bmake-20200710/str.c:108:2: [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(result, s1, len1); data/bmake-20200710/str.c:120:2: [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(result + len1, s2, len2 + 1); data/bmake-20200710/suff.c:2131:3: [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(targ->pref, sopref, prefLen); data/bmake-20200710/targ.c:548:12: [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[128]; data/bmake-20200710/trace.c:85: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). trfile = fopen(pathname, "a"); data/bmake-20200710/util.c:33:12: [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[100]; data/bmake-20200710/util.c:129:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void)memcpy(savedEnv, environ, size - sizeof(char *)); data/bmake-20200710/util.c:141:8: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void)memcpy(c, name, size); data/bmake-20200710/util.c:145:8: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void)memcpy(c, value, l_value + 1); data/bmake-20200710/util.c:250: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 pathbuf[MAXPATHLEN], nextpathbuf[MAXPATHLEN * 2]; data/bmake-20200710/util.c:326:12: [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. (void)sprintf(pathname, data/bmake-20200710/util.c:415: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). nullfp = fopen(_PATH_DEVNULL, "w"); data/bmake-20200710/var.c:561: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 tmp[BUFSIZ]; data/bmake-20200710/var.c:646: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 tmp[BUFSIZ]; data/bmake-20200710/var.c:763: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 tmp[BUFSIZ]; data/bmake-20200710/var.c:1489: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 errstr[3]; data/bmake-20200710/var.c:1689: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 rbuf[MAXPATHLEN]; data/bmake-20200710/var.c:1905: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 tmp[32]; /* each element */ data/bmake-20200710/var.c:2124:18: [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 const char hexdigits[16] = "0123456789abcdef"; data/bmake-20200710/var.c:2183: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 buf[BUFSIZ]; data/bmake-20200710/var.c:3633: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 name[2]; data/bmake-20200710/arch.c:405: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). sz = strlen(memName)+strlen(libName)+3; data/bmake-20200710/arch.c:405: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). sz = strlen(memName)+strlen(libName)+3; data/bmake-20200710/arch.c:446: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). nsz = strlen(libName) + strlen(member) + 3; data/bmake-20200710/arch.c:446: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). nsz = strlen(libName) + strlen(member) + 3; data/bmake-20200710/arch.c:471: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). size_t sz = strlen(libName) + strlen(memName) + 3; data/bmake-20200710/arch.c:471:36: [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 sz = strlen(libName) + strlen(memName) + 3; data/bmake-20200710/arch.c:600: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). size_t len = strlen(member); data/bmake-20200710/arch.c:604:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(copy, member, AR_MAX_NAME_LEN); data/bmake-20200710/arch.c:855:11: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void)strncpy(name, &ar->fnametab[entry], MAXPATHLEN); data/bmake-20200710/arch.c:921: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). len = tlen = strlen(member); data/bmake-20200710/arch.c:1236: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). size_t sz = strlen(gn->name) + 6 - 2; data/bmake-20200710/arch.c:1399:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, buf, sizeof(buf)) != sizeof(buf)) { data/bmake-20200710/cond.c:293: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). Buf_AddBytes(&buf, strlen(cp2), cp2); data/bmake-20200710/cond.c:722: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). t = if_info->defProc(strlen(lhs), lhs) != if_info->doNot; data/bmake-20200710/dir.c:707:31: [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). otherLen = brace - word + strlen(end); data/bmake-20200710/dir.c:727:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(file, word, brace-word); data/bmake-20200710/dir.c:730:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(&file[brace-word], start, cp-start); data/bmake-20200710/dir.c:898: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). char *dp = &dirpath[strlen(dirpath) - 1]; data/bmake-20200710/dir.c:1438: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). db_end = dirbase + strlen(dirbase); data/bmake-20200710/dir.c:1451: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). try_end = try + strlen(try); data/bmake-20200710/dirname.c:77:16: [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). endp = path + strlen(path) - 1; data/bmake-20200710/for.c:308: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). Buf_AddBytes(&accumFor->buf, strlen(line), line); data/bmake-20200710/for.c:371: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). Buf_AddBytes(cmds, strlen(item), item); data/bmake-20200710/for.c:477:16: [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). *ret_len = strlen(cp); data/bmake-20200710/job.c:789: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). escCmd = bmake_malloc((strlen(cmd) * 2) + 1); data/bmake-20200710/job.c:1222:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(streamID, &c, 1) == 1) { data/bmake-20200710/job.c:1866:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). nRead = read(job->inPipe, &job->outBuf[job->curPos], data/bmake-20200710/job.c:2141:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). count = read(childExitJob.inPipe, &token, 1); data/bmake-20200710/job.c:2236:14: [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 n = strlen(commandShell->exit) + 2; data/bmake-20200710/job.c:2506: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). newShell.noPLen = strlen(newShell.noPrint); data/bmake-20200710/job.c:2920:26: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (tok != '+' && read(tokenWaitJob.inPipe, &tok1, 1) == 1) data/bmake-20200710/job.c:3022:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). count = read(tokenWaitJob.inPipe, &tok, 1); data/bmake-20200710/job.c:3038:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (read(tokenWaitJob.inPipe, &tok1, 1) == 1) data/bmake-20200710/main.c:251: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(flags); data/bmake-20200710/main.c:356: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). len = strlen(modules); data/bmake-20200710/main.c:510:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(curdir, argvalue, MAXPATHLEN); data/bmake-20200710/main.c:749: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). buf = bmake_malloc(len = strlen(line) + strlen(argv0) + 2); data/bmake-20200710/main.c:749:42: [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 = bmake_malloc(len = strlen(line) + strlen(argv0) + 2); data/bmake-20200710/main.c:791:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(objdir, path, MAXPATHLEN); data/bmake-20200710/main.c:1292:12: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void)strncpy(curdir, pwd, MAXPATHLEN); data/bmake-20200710/main.c:1587: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). size_t plen = strlen(curdir) + strlen(fname) + 2; data/bmake-20200710/main.c:1587:35: [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 plen = strlen(curdir) + strlen(fname) + 2; data/bmake-20200710/main.c:1599: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). plen = strlen(objdir) + strlen(fname) + 2; data/bmake-20200710/main.c:1599:28: [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). plen = strlen(objdir) + strlen(fname) + 2; data/bmake-20200710/main.c:1726:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). cc = read(fds[0], result, sizeof(result)); data/bmake-20200710/main.c:1956:23: [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). iov[i].iov_len = strlen(iov[i].iov_base), \ data/bmake-20200710/main.c:1959:36: [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 IOADD(s) (void)write(2, s, strlen(s)) data/bmake-20200710/main.c:2122:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy(tmp, "${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'\n@}", data/bmake-20200710/main.c:2153:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy(tmp, "${.MAKEFLAGS} ${.MAKEOVERRIDES:O:u:@v@$v=${$v:Q}@}", data/bmake-20200710/make_malloc.c:79: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(str) + 1; data/bmake-20200710/make_malloc.c:98: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(str); data/bmake-20200710/meta.c:185:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((n = read(fd, buf, sizeof(buf))) > 0) { data/bmake-20200710/meta.c:292: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). ldname = strlen(dname); data/bmake-20200710/meta.c:302: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). cp = mname + strlen(dname) + 1; data/bmake-20200710/meta.c:332: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). p_len = strlen(p_make); data/bmake-20200710/meta.c:830: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). meta_prefix_len = strlen(meta_prefix); data/bmake-20200710/meta.c:917: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). x = o + strlen(&buf[o]); data/bmake-20200710/meta.c:956:16: [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 n = strlen(prefix); data/bmake-20200710/meta.c:970:16: [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 n = strlen(prefix); data/bmake-20200710/meta.c:1160: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). cwdlen = strlen(cwd); data/bmake-20200710/meta.c:1167: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). tmplen = strlen(tmpdir); data/bmake-20200710/meta.c:1727:22: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t nread = read(outfd, buf, sizeof(buf) - 1); data/bmake-20200710/parse.c:572:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). result = read(fd, lf->buf + bufpos, lf->len - bufpos); data/bmake-20200710/parse.c:2433:23: [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_len = strlen(name); data/bmake-20200710/parse.c:2437: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). ep = old + strlen(old) - name_len; data/bmake-20200710/realpath.c:115: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(resolved); data/bmake-20200710/realpath.c:189: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). if (n + (len = strlen(q)) + 1 > sizeof(wbuf[0])) { data/bmake-20200710/setenv.c:94: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). l_value = strlen(value); data/bmake-20200710/setenv.c:98: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). if (strlen(C) >= l_value) { /* old larger; copy over */ data/bmake-20200710/str.c:101: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). len1 = strlen(s1); data/bmake-20200710/str.c:102: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). len2 = strlen(s2); data/bmake-20200710/str.c:157: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). str_len = strlen(str); data/bmake-20200710/str.c:158: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). words_buf = bmake_malloc(strlen(str) + 1); data/bmake-20200710/str.c:457: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(w); data/bmake-20200710/str.c:476: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(w); data/bmake-20200710/str.c:528:23: [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_AddBytes(buf, strlen(pat), pat); data/bmake-20200710/stresep.c:70: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(s) + 1; data/bmake-20200710/suff.c:870:14: [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). sd.len = strlen(transform->name); data/bmake-20200710/suff.c:986:16: [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). s->nameLen = strlen(s->name); data/bmake-20200710/suff.c:1436: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). prefLen = strlen(targ->pref); data/bmake-20200710/suff.c:1758: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). sd.len = strlen(gn->name); data/bmake-20200710/suff.c:2066:14: [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). sd.len = strlen(gn->name); data/bmake-20200710/suff.c:2256:23: [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 savep = strlen(gn->path) - targ->suff->nameLen; data/bmake-20200710/util.c:52: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(name); data/bmake-20200710/util.c:108: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). l_value = strlen(value); data/bmake-20200710/util.c:114: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). if (strlen(c) >= l_value) /* old larger; copy over */ data/bmake-20200710/util.c:171: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). int len = strlen(str); data/bmake-20200710/var.c:408: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(env); data/bmake-20200710/var.c:489: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). len = val ? strlen(val) : 0; data/bmake-20200710/var.c:907:28: [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_AddBytes(&v->val, strlen(val), val); data/bmake-20200710/var.c:1031: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). Buf_AddBytes(&v->val, strlen(val), val); data/bmake-20200710/var.c:1166:23: [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_AddBytes(buf, strlen(base), base); data/bmake-20200710/var.c:1183:23: [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_AddBytes(buf, strlen(dot + 1), dot + 1); data/bmake-20200710/var.c:1195:55: [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 len = dot != NULL ? (size_t)(dot - word) : strlen(word); data/bmake-20200710/var.c:1217:23: [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_AddBytes(buf, strlen(word), word); data/bmake-20200710/var.c:1241:20: [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_AddBytes(buf, strlen(word), word); data/bmake-20200710/var.c:1260:23: [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_AddBytes(buf, strlen(word), word); data/bmake-20200710/var.c:1271: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). int wordLen = strlen(word); data/bmake-20200710/var.c:1540: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). Buf_AddBytes(buf, strlen(wp), wp); data/bmake-20200710/var.c:1549: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). Buf_AddBytes(buf, strlen(wp), wp); data/bmake-20200710/var.c:1583: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). Buf_AddBytes(buf, (slen = strlen(s)), s); data/bmake-20200710/var.c:1669: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). Buf_AddBytes(&buf, strlen(av[i]), av[i]); data/bmake-20200710/var.c:1698:23: [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_AddBytes(buf, strlen(word), word); data/bmake-20200710/var.c:1829: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). Buf_AddBytes(&buf, strlen(av[i]), av[i]); data/bmake-20200710/var.c:1876: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). Buf_AddBytes(&buf, strlen(av[i]), av[i]); data/bmake-20200710/var.c:2008:26: [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_AddBytes(&buf, strlen(cp2), cp2); data/bmake-20200710/var.c:2082: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). nlen = strlen(newline); data/bmake-20200710/var.c:2133: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). len2 = strlen(str); data/bmake-20200710/var.c:2308: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). Buf_AddBytes(&buf, strlen(cp2), cp2); data/bmake-20200710/var.c:2845:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant character. strncpy(st->newStr, "1", newStrSize); data/bmake-20200710/var.c:3341: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(rval) != (size_t) used) { data/bmake-20200710/var.c:3713:26: [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_AddBytes(&buf, strlen(rval), rval); data/bmake-20200710/var.c:3994:26: [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 (str[1] != *var || strlen(var) > 1) { data/bmake-20200710/var.c:4084: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). length = strlen(val); ANALYSIS SUMMARY: Hits = 297 Lines analyzed = 35428 in approximately 1.05 seconds (33698 lines/second) Physical Source Lines of Code (SLOC) = 18988 Hits@level = [0] 438 [1] 114 [2] 129 [3] 22 [4] 31 [5] 1 Hits@level+ = [0+] 735 [1+] 297 [2+] 183 [3+] 54 [4+] 32 [5+] 1 Hits/KSLOC@level+ = [0+] 38.7087 [1+] 15.6415 [2+] 9.63767 [3+] 2.8439 [4+] 1.68527 [5+] 0.0526648 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.