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/ssocr-2.19.0/ssocr.c Examining data/ssocr-2.19.0/charset.c Examining data/ssocr-2.19.0/imgproc.h Examining data/ssocr-2.19.0/charset.h Examining data/ssocr-2.19.0/help.c Examining data/ssocr-2.19.0/ssocr.h Examining data/ssocr-2.19.0/imgproc.c Examining data/ssocr-2.19.0/help.h Examining data/ssocr-2.19.0/defines.h FINAL RESULTS: data/ssocr-2.19.0/ssocr.c:80:12: [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). name = strcat(name, dir); data/ssocr-2.19.0/ssocr.c:82:12: [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). name = strcat(name, TMP_FILE_DIR); data/ssocr-2.19.0/ssocr.c:83:10: [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). name = strcat(name, DIR_SEP); data/ssocr-2.19.0/ssocr.c:84:10: [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). name = strcat(name, TMP_FILE_PATTERN); data/ssocr-2.19.0/ssocr.c:62:9: [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. dir = getenv("TMP"); data/ssocr-2.19.0/ssocr.c:189: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, "hVt:vaTn:i:d:r:m:o:O:D::pPf:b:Igl:SXCc:", data/ssocr-2.19.0/charset.c:50:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char charset_array[CHARSET_MAX + 1]; data/ssocr-2.19.0/ssocr.c:90: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). handle = mkstemp(name); data/ssocr-2.19.0/ssocr.c:230:25: [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). need_pixels = atoi(optarg); data/ssocr-2.19.0/ssocr.c:239:27: [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). ignore_pixels = atoi(optarg); data/ssocr-2.19.0/ssocr.c:248:30: [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). number_of_digits = atoi(optarg); data/ssocr-2.19.0/ssocr.c:257:23: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). one_ratio = atoi(optarg); data/ssocr-2.19.0/ssocr.c:266:25: [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). minus_ratio = atoi(optarg); data/ssocr-2.19.0/ssocr.c:483:15: [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). int n=atoi(argv[i+1]); data/ssocr-2.19.0/ssocr.c:502:15: [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). int n=atoi(argv[i+1]); data/ssocr-2.19.0/ssocr.c:521:15: [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). int n=atoi(argv[i+1]); data/ssocr-2.19.0/ssocr.c:540:15: [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). int n=atoi(argv[i+1]); data/ssocr-2.19.0/ssocr.c:571:21: [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). int bdwidth=atoi(argv[i+1]); data/ssocr-2.19.0/ssocr.c:592:51: [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). fprintf(stderr, " processing shear %d", atoi(argv[i+1])); data/ssocr-2.19.0/ssocr.c:599:26: [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). offset = (int) atoi(argv[++i]); /* sideeffect: increment i */ data/ssocr-2.19.0/ssocr.c:611:62: [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). fprintf(stderr," processing set_pixels_filter %d", atoi(argv[i+1])); data/ssocr-2.19.0/ssocr.c:618:24: [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). mask = (int) atoi(argv[++i]); /* sideeffect: increment i */ data/ssocr-2.19.0/ssocr.c:631:62: [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). fprintf(stderr," processing keep_pixels_filter %d",atoi(argv[i+1])); data/ssocr-2.19.0/ssocr.c:638:24: [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). mask = (int) atoi(argv[++i]); /* sideeffect: increment i */ data/ssocr-2.19.0/ssocr.c:651:16: [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). ww = atoi(argv[i+1]); data/ssocr-2.19.0/ssocr.c:652:16: [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). wh = atoi(argv[i+2]); data/ssocr-2.19.0/ssocr.c:745:15: [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). x = atoi(argv[i+1]); data/ssocr-2.19.0/ssocr.c:746:15: [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). y = atoi(argv[i+2]); data/ssocr-2.19.0/ssocr.c:747:16: [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). cw = atoi(argv[i+3]); data/ssocr-2.19.0/ssocr.c:748:16: [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). ch = atoi(argv[i+4]); data/ssocr-2.19.0/ssocr.c:67: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). pattern_len = strlen(dir) + strlen(DIR_SEP) + strlen(TMP_FILE_PATTERN) + 1; data/ssocr-2.19.0/ssocr.c:67: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). pattern_len = strlen(dir) + strlen(DIR_SEP) + strlen(TMP_FILE_PATTERN) + 1; data/ssocr-2.19.0/ssocr.c:67:51: [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). pattern_len = strlen(dir) + strlen(DIR_SEP) + strlen(TMP_FILE_PATTERN) + 1; data/ssocr-2.19.0/ssocr.c:71: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). pattern_len = strlen(TMP_FILE_DIR) + strlen(DIR_SEP) data/ssocr-2.19.0/ssocr.c:71:42: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). pattern_len = strlen(TMP_FILE_DIR) + strlen(DIR_SEP) data/ssocr-2.19.0/ssocr.c:72: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). + strlen(TMP_FILE_PATTERN) + 1; data/ssocr-2.19.0/ssocr.c:89:3: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(S_IRWXG | S_IRWXO); ANALYSIS SUMMARY: Hits = 37 Lines analyzed = 3386 in approximately 0.14 seconds (24625 lines/second) Physical Source Lines of Code (SLOC) = 2546 Hits@level = [0] 244 [1] 7 [2] 24 [3] 2 [4] 4 [5] 0 Hits@level+ = [0+] 281 [1+] 37 [2+] 30 [3+] 6 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 110.369 [1+] 14.5326 [2+] 11.7832 [3+] 2.35664 [4+] 1.57109 [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.