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/pngtools-0.4/pngchunks.c Examining data/pngtools-0.4/pngwrite.c Examining data/pngtools-0.4/pngchunkdesc.c Examining data/pngtools-0.4/pngcp.h Examining data/pngtools-0.4/inflateraster.c Examining data/pngtools-0.4/pngcp.c Examining data/pngtools-0.4/pnginfo.c Examining data/pngtools-0.4/pngread.c FINAL RESULTS: data/pngtools-0.4/pngcp.c:41:21: [3] (buffer) getopt: 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. while ((optchar = getopt (argc, argv, "d:s:")) != -1) data/pngtools-0.4/pnginfo.c:96:21: [3] (buffer) getopt: 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. while ((optchar = getopt (argc, argv, "tDd")) != -1) data/pngtools-0.4/pngchunkdesc.c:24:1: [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 *meanings[4][2] = { data/pngtools-0.4/pngchunkdesc.c:34: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 s[200]; data/pngtools-0.4/pngchunks.c:20: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 c[4]; data/pngtools-0.4/pngchunks.c:24:1: [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 *meanings[4][2] = { data/pngtools-0.4/pngchunks.c:52:13: [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). if ((fd = open (argv[1], O_RDONLY)) < 0) data/pngtools-0.4/pngcp.c:46: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). targetbitdepth = atoi(optarg); data/pngtools-0.4/pngcp.c:51: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). targetchannels = atoi(optarg); data/pngtools-0.4/pnginfo.c:146: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 sig[8]; data/pngtools-0.4/pnginfo.c:154: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). if ((image = fopen (filename, "rb")) == NULL) data/pngtools-0.4/pngread.c:17: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 sig[8]; data/pngtools-0.4/pngread.c:22: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). if ((image = fopen (filename, "rb")) == NULL){ data/pngtools-0.4/pngwrite.c:16:15: [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((image = fopen(filename, "wb")) == NULL){ data/pngtools-0.4/pngchunkdesc.c:38: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). s[strlen (s) - 1] = '\0'; ANALYSIS SUMMARY: Hits = 15 Lines analyzed = 1083 in approximately 0.04 seconds (26071 lines/second) Physical Source Lines of Code (SLOC) = 726 Hits@level = [0] 106 [1] 1 [2] 12 [3] 2 [4] 0 [5] 0 Hits@level+ = [0+] 121 [1+] 15 [2+] 14 [3+] 2 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 166.667 [1+] 20.6612 [2+] 19.2837 [3+] 2.75482 [4+] 0 [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.