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/pdf2djvu-0.9.17.1/config.cc Examining data/pdf2djvu-0.9.17.1/debug.cc Examining data/pdf2djvu-0.9.17.1/djvu-outline.cc Examining data/pdf2djvu-0.9.17.1/i18n.cc Examining data/pdf2djvu-0.9.17.1/image-filter.cc Examining data/pdf2djvu-0.9.17.1/pdf-backend.cc Examining data/pdf2djvu-0.9.17.1/pdf-document-map.cc Examining data/pdf2djvu-0.9.17.1/pdf-dpi.cc Examining data/pdf2djvu-0.9.17.1/pdf-unicode.cc Examining data/pdf2djvu-0.9.17.1/pdf2djvu.cc Examining data/pdf2djvu-0.9.17.1/sexpr.cc Examining data/pdf2djvu-0.9.17.1/string-format.cc Examining data/pdf2djvu-0.9.17.1/string-printf.cc Examining data/pdf2djvu-0.9.17.1/string-utils.cc Examining data/pdf2djvu-0.9.17.1/sys-command-posix.cc Examining data/pdf2djvu-0.9.17.1/sys-command-win32.cc Examining data/pdf2djvu-0.9.17.1/sys-encoding.cc Examining data/pdf2djvu-0.9.17.1/sys-time.cc Examining data/pdf2djvu-0.9.17.1/sys-uuid.cc Examining data/pdf2djvu-0.9.17.1/system.cc Examining data/pdf2djvu-0.9.17.1/version.cc Examining data/pdf2djvu-0.9.17.1/xmp.cc FINAL RESULTS: data/pdf2djvu-0.9.17.1/string-printf.cc:30: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. #define vsnprintf __mingw_vsnprintf data/pdf2djvu-0.9.17.1/string-printf.cc:37:18: [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. int length = vsnprintf(nullptr, 0, message, args_copy); data/pdf2djvu-0.9.17.1/string-printf.cc:46:14: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. length = vsprintf(buffer.data(), message, args); data/pdf2djvu-0.9.17.1/sys-command-posix.cc:249: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. execvp(c_argv[0], data/pdf2djvu-0.9.17.1/sys-uuid.cc:64:5: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(out, s); data/pdf2djvu-0.9.17.1/sys-uuid.cc:99:5: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(out, s); data/pdf2djvu-0.9.17.1/system.cc:300:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( data/pdf2djvu-0.9.17.1/system.cc:618:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buffer.data(), "%s!", path.c_str()); data/pdf2djvu-0.9.17.1/system.cc:623:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buffer.data(), "%s!", path.c_str()); data/pdf2djvu-0.9.17.1/config.cc:324:9: [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, "i:o:d:qvp:j:h", options, nullptr); data/pdf2djvu-0.9.17.1/system.cc:291:26: [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 *result = getenv("TMPDIR"); data/pdf2djvu-0.9.17.1/system.cc:330:7: [3] (tmpfile) GetTempFileName: Temporary file race condition in certain cases (e.g., if run as SYSTEM in many versions of Windows) (CWE-377). if (GetTempFileName(base_path_buffer, PACKAGE_NAME, 0, path_buffer) == 0) data/pdf2djvu-0.9.17.1/system.cc:436:7: [3] (tmpfile) GetTempFileName: Temporary file race condition in certain cases (e.g., if run as SYSTEM in many versions of Windows) (CWE-377). if (GetTempFileName(base_path_buffer, PACKAGE_NAME, 0, path_buffer) == 0) data/pdf2djvu-0.9.17.1/image-filter.cc:44:14: [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 buffer[3] = { data/pdf2djvu-0.9.17.1/image-filter.cc:55: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 buffer[4]; data/pdf2djvu-0.9.17.1/image-filter.cc:349: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. unsigned char buffer[3]; data/pdf2djvu-0.9.17.1/image-filter.cc:504:14: [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 buffer[3] = { data/pdf2djvu-0.9.17.1/pdf-backend.cc:326:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[17 + CHAR_BIT * sizeof this->timestamp.tm_year / 3]; data/pdf2djvu-0.9.17.1/pdf-unicode.cc:43: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 buffer[8]; data/pdf2djvu-0.9.17.1/pdf-unicode.cc:92:17: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[4]; data/pdf2djvu-0.9.17.1/sys-command-posix.cc:233: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). int fd = open("/dev/null", O_WRONLY); data/pdf2djvu-0.9.17.1/sys-command-posix.cc:259: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 buffer[BUFSIZ]; data/pdf2djvu-0.9.17.1/sys-command-posix.cc:320: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 child_error_reason[BUFSIZ]; data/pdf2djvu-0.9.17.1/sys-command-win32.cc:196: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. char buffer[BUFSIZ]; data/pdf2djvu-0.9.17.1/sys-command-win32.cc:330: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. char buffer[BUFSIZ]; data/pdf2djvu-0.9.17.1/sys-encoding.cc:69:19: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). wide_length = MultiByteToWideChar( data/pdf2djvu-0.9.17.1/sys-encoding.cc:125: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[BUFSIZ]; data/pdf2djvu-0.9.17.1/system.cc:256: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). this->open(name.c_str()); data/pdf2djvu-0.9.17.1/system.cc:264: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). void Directory::open(const char* path) data/pdf2djvu-0.9.17.1/system.cc:326: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 base_path_buffer[PATH_MAX]; data/pdf2djvu-0.9.17.1/system.cc:327: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 path_buffer[PATH_MAX]; data/pdf2djvu-0.9.17.1/system.cc:356:12: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). void File::open(const std::string &path, File::openmode mode) data/pdf2djvu-0.9.17.1/system.cc:364: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). this->std::fstream::open(path.c_str(), mode); data/pdf2djvu-0.9.17.1/system.cc:370: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). this->open(path, this->get_default_open_mode()); data/pdf2djvu-0.9.17.1/system.cc:378: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). this->open(stream.str(), this->get_default_open_mode()); data/pdf2djvu-0.9.17.1/system.cc:394: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). this->open(this->name, mode); data/pdf2djvu-0.9.17.1/system.cc:426:12: [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). int fd = mkstemp(path_buffer); data/pdf2djvu-0.9.17.1/system.cc:432: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 base_path_buffer[PATH_MAX]; data/pdf2djvu-0.9.17.1/system.cc:433: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 path_buffer[PATH_MAX]; data/pdf2djvu-0.9.17.1/system.cc:439: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). this->open(std::string(path_buffer), File::trunc); data/pdf2djvu-0.9.17.1/system.cc:473:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[PATH_MAX]; data/pdf2djvu-0.9.17.1/system.cc:497:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[BUFSIZ]; data/pdf2djvu-0.9.17.1/system.cc:509:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[BUFSIZ]; data/pdf2djvu-0.9.17.1/system.cc:564:13: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). wlength = MultiByteToWideChar( data/pdf2djvu-0.9.17.1/xmp.cc:68: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 uuid_s[36 + 1]; data/pdf2djvu-0.9.17.1/sys-command-posix.cc:133: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). n = write(fd, context, strlen(context)); data/pdf2djvu-0.9.17.1/sys-command-posix.cc:288:30: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t nbytes = read(stdout_pipe[0], buffer, sizeof buffer); data/pdf2djvu-0.9.17.1/sys-command-posix.cc:312:22: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t nbytes = read(error_pipe[0], &child_errno, sizeof child_errno); data/pdf2djvu-0.9.17.1/sys-command-posix.cc:321:26: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t nbytes = read( data/pdf2djvu-0.9.17.1/sys-uuid.cc:63: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). assert(strlen(s) == 36U); data/pdf2djvu-0.9.17.1/sys-uuid.cc:98: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). assert(strlen(s) == 36U); data/pdf2djvu-0.9.17.1/system.cc:298: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). : buffer(strlen(this->temporary_directory()) + strlen(PACKAGE_NAME) + 9) data/pdf2djvu-0.9.17.1/system.cc:298:50: [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). : buffer(strlen(this->temporary_directory()) + strlen(PACKAGE_NAME) + 9) data/pdf2djvu-0.9.17.1/system.cc:500:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). istream.read(buffer, sizeof buffer); data/pdf2djvu-0.9.17.1/system.cc:513:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). istream.read(buffer, chunk_size); ANALYSIS SUMMARY: Hits = 55 Lines analyzed = 6728 in approximately 0.25 seconds (27328 lines/second) Physical Source Lines of Code (SLOC) = 5588 Hits@level = [0] 0 [1] 10 [2] 32 [3] 4 [4] 9 [5] 0 Hits@level+ = [0+] 55 [1+] 55 [2+] 45 [3+] 13 [4+] 9 [5+] 0 Hits/KSLOC@level+ = [0+] 9.84252 [1+] 9.84252 [2+] 8.05297 [3+] 2.32641 [4+] 1.61059 [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.