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/pv-1.6.6/src/library/getopt.c Examining data/pv-1.6.6/src/library/gettext.c Examining data/pv-1.6.6/src/pv/signal.c Examining data/pv-1.6.6/src/pv/watchpid.c Examining data/pv-1.6.6/src/pv/cursor.c Examining data/pv-1.6.6/src/pv/file.c Examining data/pv-1.6.6/src/pv/display.c Examining data/pv-1.6.6/src/pv/loop.c Examining data/pv-1.6.6/src/pv/number.c Examining data/pv-1.6.6/src/pv/transfer.c Examining data/pv-1.6.6/src/pv/state.c Examining data/pv-1.6.6/src/main/version.c Examining data/pv-1.6.6/src/main/debug.c Examining data/pv-1.6.6/src/main/main.c Examining data/pv-1.6.6/src/main/options.c Examining data/pv-1.6.6/src/main/remote.c Examining data/pv-1.6.6/src/main/help.c Examining data/pv-1.6.6/src/include/library/getopt.h Examining data/pv-1.6.6/src/include/library/gettext.h Examining data/pv-1.6.6/src/include/pv.h Examining data/pv-1.6.6/src/include/options.h Examining data/pv-1.6.6/src/include/pv-internal.h FINAL RESULTS: data/pv-1.6.6/src/pv/watchpid.c:61:6: [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. if (readlink data/pv-1.6.6/src/main/debug.c:53: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(debugfptr, format, ap); data/pv-1.6.6/src/main/help.c:160:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(optbuf, "%s%s%s%s%s", optlist[i].optshort, data/pv-1.6.6/src/main/options.c:375:12: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (0 != access("/proc/self/fdinfo", X_OK)) { data/pv-1.6.6/src/pv/cursor.c:77:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(state->crs_lock_file, data/pv-1.6.6/src/pv/display.c:31: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, ap); data/pv-1.6.6/src/pv/display.c:212:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(sizestr_buffer, "%s%.2s%.16s", data/pv-1.6.6/src/pv/display.c:216:2: [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(buffer, bufsize, format, sizestr_buffer); data/pv-1.6.6/src/pv/display.c:818:4: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(state->str_progress, pct); data/pv-1.6.6/src/pv/display.c:911:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(state->display_buffer, spaces); data/pv-1.6.6/src/pv/file.c:59:10: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. rc = access(state->input_files[i], R_OK); data/pv-1.6.6/src/pv/state.c:78:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(state->default_format, y); \ data/pv-1.6.6/src/library/gettext.c:66:10: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. lang = getenv("LANGUAGE"); data/pv-1.6.6/src/library/gettext.c:71:11: [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. lang = getenv("LANG"); data/pv-1.6.6/src/library/gettext.c:77:11: [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. lang = getenv("LC_ALL"); data/pv-1.6.6/src/library/gettext.c:83:11: [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. lang = getenv("LC_MESSAGES"); data/pv-1.6.6/src/main/debug.c:35: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. debugfile = getenv("DEBUG"); data/pv-1.6.6/src/main/options.c:130:7: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. c = getopt_long(argc, argv, data/pv-1.6.6/src/main/options.c:134:7: [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. c = getopt(argc, argv, short_options); data/pv-1.6.6/src/pv/cursor.c:66: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. tmpdir = (char *) getenv("TMPDIR"); data/pv-1.6.6/src/pv/cursor.c:68:21: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. tmpdir = (char *) getenv("TMP"); data/pv-1.6.6/src/include/pv-internal.h:81: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 default_format[512]; /* default format string */ data/pv-1.6.6/src/include/pv-internal.h:120: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. unsigned char lastoutput_buffer[256]; data/pv-1.6.6/src/include/pv-internal.h:123: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_name[512]; data/pv-1.6.6/src/include/pv-internal.h:124: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_transferred[128]; data/pv-1.6.6/src/include/pv-internal.h:125: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_bufpercent[128]; data/pv-1.6.6/src/include/pv-internal.h:126: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_timer[128]; data/pv-1.6.6/src/include/pv-internal.h:127: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_rate[128]; data/pv-1.6.6/src/include/pv-internal.h:128: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_average_rate[128]; data/pv-1.6.6/src/include/pv-internal.h:129: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_progress[1024]; data/pv-1.6.6/src/include/pv-internal.h: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 str_lastoutput[512]; data/pv-1.6.6/src/include/pv-internal.h: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 str_eta[128]; data/pv-1.6.6/src/include/pv-internal.h:132: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_fineta[128]; data/pv-1.6.6/src/include/pv-internal.h:154: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 crs_lock_file[1024]; data/pv-1.6.6/src/include/pv-internal.h:215: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 file_fdinfo[4096]; /* path to /proc fdinfo file */ data/pv-1.6.6/src/include/pv-internal.h:216: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 file_fd[4096]; /* path to /proc fd symlink */ data/pv-1.6.6/src/include/pv-internal.h:217: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 file_fdpath[4096]; /* path to file that was opened */ data/pv-1.6.6/src/include/pv-internal.h:218: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 display_name[512]; /* name to show on progress bar */ data/pv-1.6.6/src/main/debug.c:32: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 tbuf[128]; data/pv-1.6.6/src/main/debug.c:37: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). debugfptr = fopen(debugfile, "a"); data/pv-1.6.6/src/main/main.c:84:13: [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). pidfptr = fopen(opts->pidfile, "w"); data/pv-1.6.6/src/main/remote.c:43: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 name[256]; data/pv-1.6.6/src/main/remote.c:44: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 format[256]; data/pv-1.6.6/src/pv/cursor.c:92: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). state->crs_lock_fd = open(state->crs_lock_file, openflags, 0600); data/pv-1.6.6/src/pv/cursor.c:205: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 cpr[32]; data/pv-1.6.6/src/pv/cursor.c:366:7: [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(ttyfile, O_RDWR); data/pv-1.6.6/src/pv/cursor.c:463: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 pos[32]; data/pv-1.6.6/src/pv/cursor.c:512:4: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(pos, "\033[%d;1H", state->height); data/pv-1.6.6/src/pv/cursor.c:534:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(pos, "\033[%d;1H", y); data/pv-1.6.6/src/pv/cursor.c:550: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 pos[32]; data/pv-1.6.6/src/pv/cursor.c:571:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(pos, "\033[%d;1H\n", y); data/pv-1.6.6/src/pv/display.c:178: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 sizestr_buffer[256]; data/pv-1.6.6/src/pv/display.c:179: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 si_prefix[8] = " "; data/pv-1.6.6/src/pv/display.c:202:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(sizestr_buffer, "%4ld%.2s%.16s", data/pv-1.6.6/src/pv/display.c:209: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 str_disp[64]; data/pv-1.6.6/src/pv/display.c:211:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(str_disp, "%#4.3Lg", display_amount); data/pv-1.6.6/src/pv/display.c:243:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(state->str_name, "%9.500s:", state->name); data/pv-1.6.6/src/pv/display.c:549: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 numericprefix[128]; data/pv-1.6.6/src/pv/display.c:554:4: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(numericprefix, "%.4Lf ", elapsed_sec); data/pv-1.6.6/src/pv/display.c:557:4: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(state->display_buffer, "%.99s%lld\n", data/pv-1.6.6/src/pv/display.c:561:4: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(state->display_buffer, "%.99s%ld\n", data/pv-1.6.6/src/pv/display.c:564:4: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(state->display_buffer, "%.99s%ld\n", data/pv-1.6.6/src/pv/display.c:599:4: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(state->str_bufpercent, "{%3ld%%}", data/pv-1.6.6/src/pv/display.c:605:4: [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(state->str_bufpercent, "{----}"); data/pv-1.6.6/src/pv/display.c:619:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(state->str_timer, "%ld:%02ld:%02ld", data/pv-1.6.6/src/pv/display.c:670:4: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(state->str_eta, data/pv-1.6.6/src/pv/display.c:675:4: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(state->str_eta, "%.16s %ld:%02ld:%02ld", data/pv-1.6.6/src/pv/display.c:738:4: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(state->str_fineta, "%.16s ", _("ETA")); data/pv-1.6.6/src/pv/display.c:779: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 pct[16]; data/pv-1.6.6/src/pv/display.c:789:4: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(pct, "%2ld%%", state->percentage); data/pv-1.6.6/src/pv/display.c:817:4: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(state->str_progress, "] "); data/pv-1.6.6/src/pv/display.c:841:4: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(state->str_progress, "<=>"); data/pv-1.6.6/src/pv/display.c:899: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 spaces[32]; data/pv-1.6.6/src/pv/file.c:170: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. unsigned char scanbuf[1024]; data/pv-1.6.6/src/pv/loop.c:503: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 new_format_string[512] = { 0, }; data/pv-1.6.6/src/pv/signal.c:32:7: [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("/dev/null", O_RDWR); data/pv-1.6.6/src/pv/state.c:92:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[16]; data/pv-1.6.6/src/pv/state.c:93:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(buf, "%%%uA", lastwritten); data/pv-1.6.6/src/pv/transfer.c:582: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(state->lastoutput_buffer + data/pv-1.6.6/src/pv/watchpid.c:156:9: [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). fptr = fopen(info->file_fdinfo, "r"); data/pv-1.6.6/src/pv/watchpid.c:179: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 fd_dir[512] = { 0, }; data/pv-1.6.6/src/pv/watchpid.c:280: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_array[use_idx]), pristine, data/pv-1.6.6/src/main/help.c:119: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). width = 2 + strlen(optlist[i].optshort); data/pv-1.6.6/src/main/help.c:122: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). width += 2 + strlen(optlist[i].optlong); data/pv-1.6.6/src/main/help.c:128: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). width += 1 + strlen(param); data/pv-1.6.6/src/main/help.c:178: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). while (strlen(start) > tw - col1max) { data/pv-1.6.6/src/main/remote.c:148:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(msgbuf.name, opts->name, sizeof(msgbuf.name) - 1); data/pv-1.6.6/src/main/remote.c:151:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(msgbuf.format, opts->format, data/pv-1.6.6/src/pv/cursor.c:224:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = read(terminalfd, cpr + got, 1); data/pv-1.6.6/src/pv/cursor.c:240:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = read(terminalfd, cpr, sizeof(cpr)); data/pv-1.6.6/src/pv/cursor.c:513: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). write(STDERR_FILENO, pos, strlen(pos)); data/pv-1.6.6/src/pv/cursor.c:538: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). write(STDERR_FILENO, pos, strlen(pos)); data/pv-1.6.6/src/pv/cursor.c:539: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). write(STDERR_FILENO, str, strlen(str)); data/pv-1.6.6/src/pv/cursor.c:575: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). write(STDERR_FILENO, pos, strlen(pos)); data/pv-1.6.6/src/pv/display.c:356: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). strlen(state->str_name); data/pv-1.6.6/src/pv/display.c:383: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). foundlength = strlen(&(formatstr[strpos])); data/pv-1.6.6/src/pv/display.c:527: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). state->display_buffer_size += strlen(state->name); data/pv-1.6.6/src/pv/display.c:740: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). strlen(state->str_fineta), data/pv-1.6.6/src/pv/display.c:742: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). strlen(state->str_fineta), data/pv-1.6.6/src/pv/display.c:769: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). strlen(state->format[segment].string); data/pv-1.6.6/src/pv/display.c:782:3: [1] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant character. strcpy(state->str_progress, "["); data/pv-1.6.6/src/pv/display.c:793: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). strlen(pct) - 3; data/pv-1.6.6/src/pv/display.c:808:6: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(state->str_progress, "="); data/pv-1.6.6/src/pv/display.c:811:5: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(state->str_progress, ">"); data/pv-1.6.6/src/pv/display.c:815:5: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(state->str_progress, " "); data/pv-1.6.6/src/pv/display.c:839:6: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(state->str_progress, " "); data/pv-1.6.6/src/pv/display.c:843:5: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(state->str_progress, " "); data/pv-1.6.6/src/pv/display.c:845:4: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(state->str_progress, "]"); data/pv-1.6.6/src/pv/display.c:851: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(state->str_progress) + static_portion_size > data/pv-1.6.6/src/pv/display.c:868: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). strlen(state->format[segment].string); data/pv-1.6.6/src/pv/display.c:887:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(state->display_buffer, data/pv-1.6.6/src/pv/display.c:896: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). output_length = strlen(state->display_buffer); data/pv-1.6.6/src/pv/display.c:955: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). write(STDERR_FILENO, display, strlen(display)); data/pv-1.6.6/src/pv/display.c:960: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). write(STDERR_FILENO, display, strlen(display)); data/pv-1.6.6/src/pv/file.c:173:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). numread = read(fd, scanbuf, sizeof(scanbuf)); data/pv-1.6.6/src/pv/loop.c:374: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). memmove(fmt, fmt + 2, strlen(fmt) - 1); data/pv-1.6.6/src/pv/state.c:77:4: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(state->default_format, " "); \ data/pv-1.6.6/src/pv/transfer.c:46:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(fd, buf, data/pv-1.6.6/src/pv/watchpid.c:321: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). memmove(fmt, fmt + 2, strlen(fmt) - 1); data/pv-1.6.6/src/pv/watchpid.c:361: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). path_length = strlen(info->file_fdpath); ANALYSIS SUMMARY: Hits = 120 Lines analyzed = 6740 in approximately 0.18 seconds (38086 lines/second) Physical Source Lines of Code (SLOC) = 4460 Hits@level = [0] 71 [1] 38 [2] 61 [3] 9 [4] 11 [5] 1 Hits@level+ = [0+] 191 [1+] 120 [2+] 82 [3+] 21 [4+] 12 [5+] 1 Hits/KSLOC@level+ = [0+] 42.8251 [1+] 26.9058 [2+] 18.3857 [3+] 4.70852 [4+] 2.69058 [5+] 0.224215 Dot directories skipped = 1 (--followdotdir overrides) Suppressed hits = 1 (use --neverignore to show them) 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.