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/pecomato-0.0.15/adobe.c Examining data/pecomato-0.0.15/exif.c Examining data/pecomato-0.0.15/gnu-getline.c Examining data/pecomato-0.0.15/gnu-mkstemp.c Examining data/pecomato-0.0.15/gnu-strcasecmp.c Examining data/pecomato-0.0.15/gnu-strndup.c Examining data/pecomato-0.0.15/iptc.c Examining data/pecomato-0.0.15/jfif.c Examining data/pecomato-0.0.15/main.c Examining data/pecomato-0.0.15/tiff.c Examining data/pecomato-0.0.15/adobe.h Examining data/pecomato-0.0.15/config.h Examining data/pecomato-0.0.15/exif.h Examining data/pecomato-0.0.15/gnu-getline.h Examining data/pecomato-0.0.15/gnu-mkstemp.h Examining data/pecomato-0.0.15/gnu-strcasecmp.h Examining data/pecomato-0.0.15/gnu-strndup.h Examining data/pecomato-0.0.15/iptc.h Examining data/pecomato-0.0.15/jfif.h Examining data/pecomato-0.0.15/tiff.h Examining data/pecomato-0.0.15/util.h Examining data/pecomato-0.0.15/util.c FINAL RESULTS: data/pecomato-0.0.15/main.c:48:2: [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(PRODUCT_ID " " PRODUCT_VERSION "\n"); data/pecomato-0.0.15/main.c:807:6: [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(output_filename, pathname); data/pecomato-0.0.15/main.c:808:6: [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(output_filename, DIR_SEPARATOR_STRING); data/pecomato-0.0.15/main.c:810:5: [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(output_filename, filename); data/pecomato-0.0.15/main.c:855:5: [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(iptc_filename, pathname); data/pecomato-0.0.15/main.c:856:5: [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(iptc_filename, DIR_SEPARATOR_STRING); data/pecomato-0.0.15/main.c:858: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(iptc_filename, filename); data/pecomato-0.0.15/main.c:860: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(iptc_filename, extract_extension); data/pecomato-0.0.15/util.c:365: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(backup_filename, filename); data/pecomato-0.0.15/util.c:530:3: [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/pecomato-0.0.15/util.c:551:3: [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/pecomato-0.0.15/util.c:570:3: [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/pecomato-0.0.15/util.c:586:3: [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(stdout, format, args); data/pecomato-0.0.15/util.c:603:3: [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(stdout, format, args); data/pecomato-0.0.15/util.c:820: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(filename, output_filename); data/pecomato-0.0.15/exif.c:247: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 exif_marker[5]; data/pecomato-0.0.15/gnu-mkstemp.c:36:1: [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). mkstemp (template) data/pecomato-0.0.15/gnu-mkstemp.c:51:7: [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. if (sprintf (&template[len - 5], "%.5u", data/pecomato-0.0.15/gnu-mkstemp.c:62: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). fd = open (template, O_RDWR|O_BINARY|O_CREAT|O_EXCL, 0600); data/pecomato-0.0.15/gnu-mkstemp.h:25:5: [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 mkstemp (char *template); data/pecomato-0.0.15/gnu-strndup.c:41:19: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. return (char *) memcpy (ns, s, len); data/pecomato-0.0.15/iptc.c:363: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(value, ptr+1+2+2+extended_length, length); data/pecomato-0.0.15/iptc.c:495: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(iptc_extract_buffer, data/pecomato-0.0.15/iptc.c:508: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(iptc_extract_buffer, buffer, iptc_extract_buffer_size); data/pecomato-0.0.15/iptc.c:1021: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 dataset_header[7]; /* IPTC marker + record code (2 bytes) + dataset size (2 bytes) + version (2 bytes)*/ data/pecomato-0.0.15/jfif.c:268: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. char exif_marker[5]; data/pecomato-0.0.15/jfif.c:314:7: [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 product[100]; data/pecomato-0.0.15/main.c:54: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 spaces[19]; data/pecomato-0.0.15/main.c:228: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 tmp[7]; /* max length of file signature sequence + 1 */ data/pecomato-0.0.15/main.c:571:14: [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). list_file=fopen(filename, "r"); data/pecomato-0.0.15/main.c:662:17: [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). include_file=fopen(include_filename, "r"); data/pecomato-0.0.15/main.c:690:18: [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). exclude_file=fopen(exclude_filename, "r"); data/pecomato-0.0.15/main.c:718:14: [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). edit_file=fopen(edit_filename, "r"); data/pecomato-0.0.15/main.c:769:14: [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). input_file=fopen(input_filename, "rb"); data/pecomato-0.0.15/main.c:1125: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). iptc_file=fopen(iptc_filename, "w+b"); data/pecomato-0.0.15/util.c:366:2: [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(backup_filename, ".bak"); data/pecomato-0.0.15/util.c:475: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(buf, ptr+offset, len*sizeof(unsigned char)); data/pecomato-0.0.15/util.c:821:2: [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(filename, ".XXXXXX"); data/pecomato-0.0.15/util.c:822:5: [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). fd=mkstemp(filename); data/pecomato-0.0.15/util.c:882: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(rewrite_cache+rewrite_cache_offset, buffer, length); data/pecomato-0.0.15/util.c:929: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(rewrite_cache+rewrite_cache_offset, buffer+result->parsed_bytes, len); data/pecomato-0.0.15/util.c:1404: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(buffer_copy, buffer, buffer_length); data/pecomato-0.0.15/util.c:1484:7: [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 one_byte[3]; data/pecomato-0.0.15/util.c:1532:8: [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(stored_value, value, stored_value_length); data/pecomato-0.0.15/gnu-getline.c:54:15: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c = getc (stream)) != EOF) data/pecomato-0.0.15/gnu-mkstemp.c:44: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). len = strlen (template); data/pecomato-0.0.15/main.c:133: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). for (j=0; j<(int)(18-strlen(op_labels[i].label)); j++) data/pecomato-0.0.15/main.c:311: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). ptr+=strlen(ptr)-1; data/pecomato-0.0.15/main.c:794: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). sz+=strlen(pathname)+1; data/pecomato-0.0.15/main.c:798: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). sz+=strlen(filename); data/pecomato-0.0.15/main.c:838: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). sz+=strlen(pathname)+1; data/pecomato-0.0.15/main.c:845: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). sz+=strlen(filename); data/pecomato-0.0.15/main.c:848: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). sz+=1+strlen(extract_extension)+1; data/pecomato-0.0.15/main.c:859: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(iptc_filename, "."); data/pecomato-0.0.15/main.c:1070: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). len=strlen(output_filename)-7; /* get rid of the trailing random chars from mkstemp */ data/pecomato-0.0.15/main.c:1074:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(rewrite_filename, output_filename, len); data/pecomato-0.0.15/main.c:1075:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy(rewrite_filename+len, ".rewrite", 1+7); data/pecomato-0.0.15/main.c:1095:47: [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). target_filename=strndup(output_filename, strlen(output_filename)-7); data/pecomato-0.0.15/util.c:337: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). len=strlen(path); data/pecomato-0.0.15/util.c:362: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). backup_filename=malloc((strlen(filename)+1+4)*sizeof(char)); data/pecomato-0.0.15/util.c:816: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). len=strlen(output_filename); data/pecomato-0.0.15/util.c:1048: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). ptr=(char*)string+strlen(string)-1; data/pecomato-0.0.15/util.c:1116:52: [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). filenames_list[filenames_count]=strndup(buffer, strlen(buffer)+1); data/pecomato-0.0.15/util.c:1119: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(buffer)+1)*sizeof(char)); data/pecomato-0.0.15/util.c:1195:11: [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(ptr)==6) && get_hexa_value(ptr, &code) data/pecomato-0.0.15/util.c:1196:11: [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(p)==6) && get_hexa_value(p, &code2)) data/pecomato-0.0.15/util.c:1209:11: [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(ptr)==6) && get_hexa_value(ptr, &code)) data/pecomato-0.0.15/util.c:1326: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). len=strlen(buffer); data/pecomato-0.0.15/util.c:1545: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). if ((strlen(ptr)==6) && get_hexa_value(ptr, &code)) data/pecomato-0.0.15/util.c:1658: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). len=strlen(buffer); ANALYSIS SUMMARY: Hits = 70 Lines analyzed = 7287 in approximately 0.22 seconds (33037 lines/second) Physical Source Lines of Code (SLOC) = 5475 Hits@level = [0] 154 [1] 26 [2] 29 [3] 0 [4] 15 [5] 0 Hits@level+ = [0+] 224 [1+] 70 [2+] 44 [3+] 15 [4+] 15 [5+] 0 Hits/KSLOC@level+ = [0+] 40.9132 [1+] 12.7854 [2+] 8.03653 [3+] 2.73973 [4+] 2.73973 [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.