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/bfs-2.1/bar.c Examining data/bfs-2.1/bar.h Examining data/bfs-2.1/bfs.h Examining data/bfs-2.1/bftw.c Examining data/bfs-2.1/bftw.h Examining data/bfs-2.1/color.c Examining data/bfs-2.1/color.h Examining data/bfs-2.1/ctx.c Examining data/bfs-2.1/ctx.h Examining data/bfs-2.1/darray.c Examining data/bfs-2.1/darray.h Examining data/bfs-2.1/diag.c Examining data/bfs-2.1/diag.h Examining data/bfs-2.1/dstring.c Examining data/bfs-2.1/dstring.h Examining data/bfs-2.1/eval.c Examining data/bfs-2.1/eval.h Examining data/bfs-2.1/exec.c Examining data/bfs-2.1/exec.h Examining data/bfs-2.1/expr.h Examining data/bfs-2.1/fsade.c Examining data/bfs-2.1/fsade.h Examining data/bfs-2.1/main.c Examining data/bfs-2.1/mtab.c Examining data/bfs-2.1/mtab.h Examining data/bfs-2.1/opt.c Examining data/bfs-2.1/opt.h Examining data/bfs-2.1/parse.c Examining data/bfs-2.1/parse.h Examining data/bfs-2.1/printf.c Examining data/bfs-2.1/printf.h Examining data/bfs-2.1/pwcache.c Examining data/bfs-2.1/pwcache.h Examining data/bfs-2.1/spawn.c Examining data/bfs-2.1/spawn.h Examining data/bfs-2.1/stat.c Examining data/bfs-2.1/stat.h Examining data/bfs-2.1/tests/mksock.c Examining data/bfs-2.1/tests/trie.c Examining data/bfs-2.1/tests/xtimegm.c Examining data/bfs-2.1/time.c Examining data/bfs-2.1/time.h Examining data/bfs-2.1/trie.c Examining data/bfs-2.1/trie.h Examining data/bfs-2.1/typo.c Examining data/bfs-2.1/typo.h Examining data/bfs-2.1/util.c Examining data/bfs-2.1/util.h FINAL RESULTS: data/bfs-2.1/bar.c:102: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(ptr, data/bfs-2.1/dstring.c:152:8: [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. len = vsnprintf(str, cap + 1, format, args); data/bfs-2.1/dstring.c:159:9: [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. len = vsnprintf(str, cap + 1, format, args2); data/bfs-2.1/eval.c:719:42: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. if (bfs_printf(expr->cfile->file, expr->printf, state->ftwbuf) != 0) { data/bfs-2.1/exec.c:58:2: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, format, args); data/bfs-2.1/exec.c:215: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(path + 2, name); data/bfs-2.1/expr.h:163:21: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. struct bfs_printf *printf; data/bfs-2.1/parse.c:113:24: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. bfs_printf_free(expr->printf); data/bfs-2.1/parse.c:1276:13: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. if (!expr->printf) { data/bfs-2.1/parse.c:2014:13: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. if (!expr->printf) { data/bfs-2.1/printf.c:75:12: [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. int ret = snprintf(buf, sizeof(buf), format, __VA_ARGS__); \ data/bfs-2.1/printf.c:110:9: [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. return fprintf(file, directive->str, buf); data/bfs-2.1/printf.c:178:9: [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. return fprintf(file, directive->str, buf); data/bfs-2.1/printf.c:190:9: [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. return fprintf(file, directive->str, buf); data/bfs-2.1/printf.c:195:9: [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. return fprintf(file, directive->str, (intmax_t)ftwbuf->depth); data/bfs-2.1/printf.c:206:9: [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. return fprintf(file, directive->str, buf); data/bfs-2.1/printf.c:211:9: [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. return fprintf(file, directive->str, ftwbuf->path + ftwbuf->nameoff); data/bfs-2.1/printf.c:222:9: [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. return fprintf(file, directive->str, type); data/bfs-2.1/printf.c:233:9: [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. return fprintf(file, directive->str, buf); data/bfs-2.1/printf.c:249:9: [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. return fprintf(file, directive->str, grp->gr_name); data/bfs-2.1/printf.c:274: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. int ret = fprintf(file, directive->str, buf); data/bfs-2.1/printf.c:281:9: [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. return fprintf(file, directive->str, ftwbuf->root); data/bfs-2.1/printf.c:292:9: [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. return fprintf(file, directive->str, buf); data/bfs-2.1/printf.c:304:9: [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. return fprintf(file, directive->str, buf); data/bfs-2.1/printf.c:322: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. int ret = fprintf(file, directive->str, target); data/bfs-2.1/printf.c:334:9: [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. return fprintf(file, directive->str, (unsigned int)(statbuf->mode & 07777)); data/bfs-2.1/printf.c:346:9: [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. return fprintf(file, directive->str, buf); data/bfs-2.1/printf.c:357:9: [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. return fprintf(file, directive->str, buf); data/bfs-2.1/printf.c:362:9: [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. return fprintf(file, directive->str, ftwbuf->path); data/bfs-2.1/printf.c:371:9: [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. return fprintf(file, directive->str, path); data/bfs-2.1/printf.c:382:9: [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. return fprintf(file, directive->str, buf); data/bfs-2.1/printf.c:398:9: [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. return fprintf(file, directive->str, sparsity); data/bfs-2.1/printf.c:409:9: [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. return fprintf(file, directive->str, buf); data/bfs-2.1/printf.c:425:9: [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. return fprintf(file, directive->str, pwd->pw_name); data/bfs-2.1/printf.c:454:9: [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. return fprintf(file, directive->str, type); data/bfs-2.1/printf.c:486: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. int ret = fprintf(file, directive->str, type); data/bfs-2.1/spawn.c:137:9: [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. return execvp(exe, argv); data/bfs-2.1/util.h:90:57: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. # define BFS_FORMATTER(fmt, args) __attribute__((format(printf, fmt, args))) data/bfs-2.1/parse.c:2472:16: [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 *pager = getenv("PAGER"); data/bfs-2.1/parse.c:2523: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. if (!getenv("LESS")) { data/bfs-2.1/parse.c:3503:6: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (getenv("NO_COLOR")) { data/bfs-2.1/parse.c:3508: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. ctx->colors = parse_colors(getenv("LS_COLORS")); data/bfs-2.1/parse.c:3529: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. if (!getenv("POSIXLY_CORRECT")) { data/bfs-2.1/bar.c:94: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 esc_seq[12 + ITOA_DIGITS] = data/bfs-2.1/bar.c:174: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 term[L_ctermid]; data/bfs-2.1/bar.c:181: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). the_bar.fd = open(term, O_RDWR | O_CLOEXEC); data/bfs-2.1/bftw.c:333: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(file->name, name, namelen + 1); data/bfs-2.1/bftw.c:1224: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(state->path + file->nameoff, file->name, file->namelen); data/bfs-2.1/color.c:504:16: [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). cfile->file = fopen(path, "wb"); data/bfs-2.1/color.c:1048: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[len + 1]; data/bfs-2.1/color.c:1049: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(name, i, len); data/bfs-2.1/darray.c:80: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(data + i*size, item, size); data/bfs-2.1/dstring.c:53: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(header->data, data, length); data/bfs-2.1/dstring.c:115: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(*dest + oldlen, src, srclen); data/bfs-2.1/eval.c:605: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 mode[11]; data/bfs-2.1/eval.c:658: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 time_str[256]; data/bfs-2.1/exec.c:214:2: [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(path, "./"); data/bfs-2.1/exec.c:299:20: [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). execbuf->wd_fd = open(execbuf->wd_path, O_RDONLY | O_CLOEXEC | O_DIRECTORY); data/bfs-2.1/main.c:74:14: [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). int newfd = open(path, flags); data/bfs-2.1/mtab.c:165:15: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE *file = fopen(MNTTAB, "r"); data/bfs-2.1/parse.c:2533: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(envp, environ, (envc - 1)*sizeof(*envp)); data/bfs-2.1/printf.c:74: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[256]; \ data/bfs-2.1/printf.c:131: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[256]; data/bfs-2.1/printf.c:344: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[11]; data/bfs-2.1/spawn.c:142:34: [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 void bfs_spawn_exec(const char *exe, const struct bfs_spawn *ctx, char **argv, char **envp, int pipefd[2]) { data/bfs-2.1/spawn.c:142:74: [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 void bfs_spawn_exec(const char *exe, const struct bfs_spawn *ctx, char **argv, char **envp, int pipefd[2]) { data/bfs-2.1/spawn.c:142:87: [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 void bfs_spawn_exec(const char *exe, const struct bfs_spawn *ctx, char **argv, char **envp, int pipefd[2]) { data/bfs-2.1/stat.c:359: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(*id, &buf->dev, sizeof(buf->dev)); data/bfs-2.1/stat.c:360: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(*id + sizeof(buf->dev), &buf->ino, sizeof(buf->ino)); data/bfs-2.1/stat.h:145: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. typedef unsigned char bfs_file_id[sizeof(dev_t) + sizeof(ino_t)]; data/bfs-2.1/tests/mksock.c:86: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(sock->sun_path, base, len + 1); data/bfs-2.1/time.c:188: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[n + 1]; data/bfs-2.1/time.c:198: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). *result = atoi(buf); data/bfs-2.1/trie.c:327: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(leaf->key, key, length); data/bfs-2.1/util.c:176:28: [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. void xstrmode(mode_t mode, char str[11]) { data/bfs-2.1/util.c:177:2: [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(str, "----------"); data/bfs-2.1/util.h:172:28: [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. void xstrmode(mode_t mode, char str[11]); data/bfs-2.1/bar.c:59: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). size_t len = strlen(str); data/bfs-2.1/bar.c:99: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 *ptr = esc_seq + strlen(esc_seq); data/bfs-2.1/bar.c:176:6: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen(term) == 0) { data/bfs-2.1/bftw.c:302: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 namelen = strlen(name); data/bfs-2.1/color.c:133: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). size_t len = strlen(ext); data/bfs-2.1/color.c:454: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). if (strspn(value, "0") == strlen(value) data/bfs-2.1/color.c:822:48: [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). return print_colored(colors, color, filename, strlen(filename), file); data/bfs-2.1/dstring.c:63: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). size_t len = strlen(str); data/bfs-2.1/dstring.c:120:33: [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). return dstrcat_impl(dest, src, strlen(src)); data/bfs-2.1/dstring.c:143: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 len, cap = 2*strlen(format); data/bfs-2.1/eval.c:708: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 length = strlen(path) + 1; data/bfs-2.1/eval.c:786: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). size_t len = strlen(path); data/bfs-2.1/eval.c:1076: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). pathlen = strlen(path); data/bfs-2.1/eval.c:1185: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). size_t baselen = strlen(ftwbuf->path) - strlen(ftwbuf->at_path); data/bfs-2.1/eval.c:1185:43: [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 baselen = strlen(ftwbuf->path) - strlen(ftwbuf->at_path); data/bfs-2.1/exec.c:66: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). return sizeof(arg) + strlen(arg) + 1; data/bfs-2.1/exec.c:209: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). char *path = malloc(2 + strlen(name) + 1); data/bfs-2.1/parse.c:761: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). if (len == strlen(expected)) { data/bfs-2.1/parse.c:1598:6: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen(arg) != 8) { data/bfs-2.1/parse.c:2249:6: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen(unit) > 1) { data/bfs-2.1/parse.c:2987:37: [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). match = strncmp(arg, entry->arg, strlen(entry->arg)) == 0; data/bfs-2.1/printf.c:367: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). const char *path = ftwbuf->path + strlen(ftwbuf->root); data/bfs-2.1/spawn.c:229:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t nbytes = read(pipefd[0], &error, sizeof(error)); data/bfs-2.1/tests/mksock.c:66: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). size_t len = strlen(path); data/bfs-2.1/tests/mksock.c:78: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(base); data/bfs-2.1/tests/trie.c:49: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). if (strncmp(keys[i], keys[j], strlen(keys[j])) == 0) { data/bfs-2.1/tests/trie.c:67: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). assert(leaf->length == strlen(keys[i]) + 1); data/bfs-2.1/tests/trie.c:74: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). assert(leaf->length == strlen(keys[i]) + 1); data/bfs-2.1/tests/trie.c:82: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). if (strncmp(keys[i], keys[j], strlen(keys[i])) == 0) { data/bfs-2.1/trie.c:227: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). return trie_find_mem(trie, key, strlen(key) + 1); data/bfs-2.1/trie.c:240: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 length = strlen(key); data/bfs-2.1/trie.c:287: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 length = strlen(key) + 1; data/bfs-2.1/trie.c:487:130: [1] (buffer) mismatch: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. static struct trie_leaf *trie_split(uintptr_t *ptr, const void *key, size_t length, struct trie_leaf *rep, size_t offset, size_t mismatch) { data/bfs-2.1/trie.c:488:50: [1] (buffer) mismatch: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. unsigned char key_nibble = trie_key_nibble(key, mismatch); data/bfs-2.1/trie.c:489:55: [1] (buffer) mismatch: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. unsigned char rep_nibble = trie_key_nibble(rep->key, mismatch); data/bfs-2.1/trie.c:520: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). return trie_insert_mem(trie, key, strlen(key) + 1); data/bfs-2.1/trie.c:535:7: [1] (buffer) mismatch: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. if ((mismatch >> 1) >= length) { data/bfs-2.1/trie.c:543:31: [1] (buffer) mismatch: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. if (offset + node->offset > mismatch) { data/bfs-2.1/trie.c:551:20: [1] (buffer) mismatch: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. assert(offset < mismatch); data/bfs-2.1/trie.c:555:21: [1] (buffer) mismatch: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. assert(offset == mismatch); data/bfs-2.1/trie.c:567:51: [1] (buffer) mismatch: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. return trie_split(ptr, key, length, rep, offset, mismatch); data/bfs-2.1/typo.c:142: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 rows = strlen(actual) + 1; data/bfs-2.1/typo.c:143: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 cols = strlen(expected) + 1; data/bfs-2.1/util.c:228: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). for (i = path + strlen(path); i > path && i[-1] == '/'; --i); data/bfs-2.1/util.c:265:11: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int c = getchar(); ANALYSIS SUMMARY: Hits = 122 Lines analyzed = 17514 in approximately 0.44 seconds (39644 lines/second) Physical Source Lines of Code (SLOC) = 11441 Hits@level = [0] 66 [1] 45 [2] 34 [3] 5 [4] 38 [5] 0 Hits@level+ = [0+] 188 [1+] 122 [2+] 77 [3+] 43 [4+] 38 [5+] 0 Hits/KSLOC@level+ = [0+] 16.4321 [1+] 10.6634 [2+] 6.73018 [3+] 3.75841 [4+] 3.32139 [5+] 0 Dot directories skipped = 1 (--followdotdir overrides) Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code! See 'Secure Programming HOWTO' (https://dwheeler.com/secure-programs) for more information.