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/unpaper-6.1/unpaper.h Examining data/unpaper-6.1/imageprocess.c Examining data/unpaper-6.1/tools.h Examining data/unpaper-6.1/unpaper.c Examining data/unpaper-6.1/parse.h Examining data/unpaper-6.1/tools.c Examining data/unpaper-6.1/parse.c Examining data/unpaper-6.1/imageprocess.h Examining data/unpaper-6.1/file.c FINAL RESULTS: data/unpaper-6.1/file.c:259:9: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(debugFilename, filenameTemplate, index); data/unpaper-6.1/parse.c:244: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(str, &s[pos+1]); // copy rest after ',' data/unpaper-6.1/parse.c:281:13: [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(buf, s[0]); data/unpaper-6.1/parse.c:283:13: [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(buf, BLANK_TEXT); data/unpaper-6.1/parse.c:287:17: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf + strlen(buf), ", %s", s[i]); data/unpaper-6.1/parse.c:289:17: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf + strlen(buf), ", %s", BLANK_TEXT); data/unpaper-6.1/parse.c:334:17: [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(s1, s2); // s2 -> s1 data/unpaper-6.1/parse.c:335:17: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. sscanf(s1, "%d,%s", &index, s2); data/unpaper-6.1/parse.c:353:13: [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(s1, s2); // s2 -> s1 data/unpaper-6.1/unpaper.c:183:5: [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, vl); data/unpaper-6.1/unpaper.c:925:9: [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. printf(WELCOME); // welcome message data/unpaper-6.1/unpaper.c:971:17: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(inputFilesBuffer[i], argv[optind], inputNr++); data/unpaper-6.1/unpaper.c:1003:17: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(outputFilesBuffer[i], argv[optind], outputNr++); data/unpaper-6.1/unpaper.h:113:27: [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. __attribute__((format(printf, 1, 2))) data/unpaper-6.1/unpaper.h:238:27: [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. __attribute__((format(printf, 1, 0))); data/unpaper-6.1/file.c:49: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 errbuff[1024]; data/unpaper-6.1/file.c:156: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 errbuff[1024]; data/unpaper-6.1/file.c:258: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 debugFilename[100]; data/unpaper-6.1/parse.c:40: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 unit[4]; data/unpaper-6.1/parse.c:51: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[24]; data/unpaper-6.1/parse.c:217: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 str[255]; data/unpaper-6.1/tools.c:98: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 errbuff[1024]; data/unpaper-6.1/unpaper.c:951: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 inputFilesBuffer[2][255]; data/unpaper-6.1/unpaper.c:952: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 outputFilesBuffer[2][255]; data/unpaper-6.1/unpaper.c:953: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 *inputFileNames[2]; data/unpaper-6.1/unpaper.c:954: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 *outputFileNames[2]; data/unpaper-6.1/unpaper.c:1028: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 s1[1023]; // buffers for result of implode() data/unpaper-6.1/unpaper.c:1029: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 s2[1023]; data/unpaper-6.1/parse.c:239:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(str, s, pos); data/unpaper-6.1/parse.c:287: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). sprintf(buf + strlen(buf), ", %s", s[i]); data/unpaper-6.1/parse.c:289: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). sprintf(buf + strlen(buf), ", %s", BLANK_TEXT); data/unpaper-6.1/parse.c:356:56: [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 ((multiIndex->count < MAX_MULTI_INDEX) && (strlen(s1) > 0)); ANALYSIS SUMMARY: Hits = 32 Lines analyzed = 4685 in approximately 0.17 seconds (27459 lines/second) Physical Source Lines of Code (SLOC) = 3339 Hits@level = [0] 221 [1] 4 [2] 13 [3] 0 [4] 15 [5] 0 Hits@level+ = [0+] 253 [1+] 32 [2+] 28 [3+] 15 [4+] 15 [5+] 0 Hits/KSLOC@level+ = [0+] 75.7712 [1+] 9.58371 [2+] 8.38574 [3+] 4.49236 [4+] 4.49236 [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.