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/kdc2tiff-0.35/include/tif_dir.h Examining data/kdc2tiff-0.35/include/port.h Examining data/kdc2tiff-0.35/include/tiffconf.h Examining data/kdc2tiff-0.35/include/tiffiop.h Examining data/kdc2tiff-0.35/GFile.cpp Examining data/kdc2tiff-0.35/GFile.h Examining data/kdc2tiff-0.35/GFile_DC120.cpp Examining data/kdc2tiff-0.35/GFile_DC120.h Examining data/kdc2tiff-0.35/GFile_JPEG.cpp Examining data/kdc2tiff-0.35/GFile_JPEG.h Examining data/kdc2tiff-0.35/GFile_TIFF.cpp Examining data/kdc2tiff-0.35/GFile_TIFF.h Examining data/kdc2tiff-0.35/GFilter.cpp Examining data/kdc2tiff-0.35/GFilter.h Examining data/kdc2tiff-0.35/GICBayer.cpp Examining data/kdc2tiff-0.35/GICBayer.h Examining data/kdc2tiff-0.35/GImage.cpp Examining data/kdc2tiff-0.35/GImage.h Examining data/kdc2tiff-0.35/GImageComponent.cpp Examining data/kdc2tiff-0.35/GImageComponent.h Examining data/kdc2tiff-0.35/KDCFile.cpp Examining data/kdc2tiff-0.35/KDCFile.h Examining data/kdc2tiff-0.35/OutputOptions.cpp Examining data/kdc2tiff-0.35/OutputOptions.h Examining data/kdc2tiff-0.35/kdc2tiff.cpp Examining data/kdc2tiff-0.35/xtif_dir.c Examining data/kdc2tiff-0.35/xtiffio.h Examining data/kdc2tiff-0.35/xtiffiop.h FINAL RESULTS: data/kdc2tiff-0.35/OutputOptions.cpp:130: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(outputname,inputname); data/kdc2tiff-0.35/OutputOptions.cpp:133:7: [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(extension, outputtiff?".tif":".jpg"); data/kdc2tiff-0.35/OutputOptions.cpp:135:7: [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(outputname,outputtiff?".tif":".jpg"); data/kdc2tiff-0.35/kdc2tiff.cpp:189:7: [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(comment_text,options.kdcfile->Model); data/kdc2tiff-0.35/kdc2tiff.cpp:194:7: [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(comment_text,options.kdcfile->DateTime); data/kdc2tiff-0.35/kdc2tiff.cpp:199:7: [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(comment_text,options.copyright); data/kdc2tiff-0.35/GFile_DC120.cpp:133: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 header[4]; data/kdc2tiff-0.35/GFile_DC120.cpp:141: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 sig[5]; data/kdc2tiff-0.35/GFile_JPEG.cpp:36: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). if ((infile = fopen(filename, "rb")) == NULL) { data/kdc2tiff-0.35/GFile_JPEG.cpp:125: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 header[2]; data/kdc2tiff-0.35/GFile_TIFF.cpp:67: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 header[4]; data/kdc2tiff-0.35/KDCFile.cpp:294: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(rawdata,jpeghead,sizeof(jpeghead)); data/kdc2tiff-0.35/OutputOptions.cpp:205:19: [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). rowsperstrip=atoi(argv[0]); data/kdc2tiff-0.35/OutputOptions.cpp:223:14: [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). quality=atoi(argv[0]); data/kdc2tiff-0.35/OutputOptions.cpp:236:18: [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). outputwidth=atoi(argv[0]); data/kdc2tiff-0.35/OutputOptions.cpp:250:19: [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). outputheight=atoi(argv[0]); data/kdc2tiff-0.35/OutputOptions.cpp:321:19: [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). lightwhite=atoi(argv[0]); data/kdc2tiff-0.35/OutputOptions.cpp:389:22: [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). contrastenhance=atoi(argv[0]); data/kdc2tiff-0.35/kdc2tiff.cpp:114: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 rgb[options.outputwidth*3]; data/kdc2tiff-0.35/kdc2tiff.cpp:156: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). if ((outfile = fopen(options.outputname, "wb")) == NULL) { data/kdc2tiff-0.35/kdc2tiff.cpp:188:7: [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(comment_text,"Model: "); data/kdc2tiff-0.35/kdc2tiff.cpp:193:7: [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(comment_text,"DateTime: "); data/kdc2tiff-0.35/kdc2tiff.cpp:198:7: [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(comment_text,"Copyright: "); data/kdc2tiff-0.35/kdc2tiff.cpp:205: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 rgb[options.outputwidth*3]; data/kdc2tiff-0.35/kdc2tiff.cpp:325: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). FILE* input = fopen(globaloptions.inputname,"r"); data/kdc2tiff-0.35/OutputOptions.cpp:129: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). outputname = new char[strlen(inputname)+5]; data/kdc2tiff-0.35/kdc2tiff.cpp:182: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). (options.kdcfile->DateTime?strlen(options.kdcfile->DateTime):0) + data/kdc2tiff-0.35/kdc2tiff.cpp:183: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). (options.kdcfile->Model?strlen(options.kdcfile->Model):0) + data/kdc2tiff-0.35/kdc2tiff.cpp:184: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). (options.copyright?strlen(options.copyright):0); data/kdc2tiff-0.35/kdc2tiff.cpp:190:7: [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(comment_text,"\n"); data/kdc2tiff-0.35/kdc2tiff.cpp:197:7: [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(comment_text,"\n"); data/kdc2tiff-0.35/kdc2tiff.cpp:202: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(comment_text)); ANALYSIS SUMMARY: Hits = 32 Lines analyzed = 5884 in approximately 0.19 seconds (30597 lines/second) Physical Source Lines of Code (SLOC) = 3939 Hits@level = [0] 158 [1] 7 [2] 19 [3] 0 [4] 6 [5] 0 Hits@level+ = [0+] 190 [1+] 32 [2+] 25 [3+] 6 [4+] 6 [5+] 0 Hits/KSLOC@level+ = [0+] 48.2356 [1+] 8.12389 [2+] 6.34679 [3+] 1.52323 [4+] 1.52323 [5+] 0 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.