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/read-edid-3.0.2/get-edid/get-edid.c Examining data/read-edid-3.0.2/get-edid/i2c-dev.h Examining data/read-edid-3.0.2/get-edid/classic.c Examining data/read-edid-3.0.2/get-edid/i2c.c Examining data/read-edid-3.0.2/parse-edid/parse-edid.c Examining data/read-edid-3.0.2/parse-edid/modes.h FINAL RESULTS: data/read-edid-3.0.2/get-edid/classic.c:28:40: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define display(...) if (quiet == 0) { fprintf(stderr, __VA_ARGS__); } data/read-edid-3.0.2/get-edid/get-edid.c:17:40: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define display(...) if (quiet == 0) { fprintf(stderr, __VA_ARGS__); } data/read-edid-3.0.2/get-edid/i2c.c:20:40: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define display(...) if (quiet == 0) { fprintf(stderr, __VA_ARGS__); } data/read-edid-3.0.2/parse-edid/parse-edid.c:183:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(modearray[currentmode], "%s%u %u %u %u ", modearray[currentmode], hactive, hactive+hsyncoff, hactive+hsyncoff+hsyncwidth, hactive+hblank); data/read-edid-3.0.2/parse-edid/parse-edid.c:184:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(modearray[currentmode], "%s%u %u %u %u ", modearray[currentmode], vactive, vactive+vsyncoff, vactive+vsyncoff+vsyncwidth, vactive+vblank); data/read-edid-3.0.2/parse-edid/parse-edid.c:187:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(modearray[currentmode], "%s%shsync %svsync %s", modearray[currentmode], ((edid[i+17]&0x10) && edid[i+17]&0x02) ? "+": "-", ((edid[i+17]&0x10) && edid[i+17]&0x04) ? "+": "-", (edid[i+17]&0x80) ? "interlace": ""); data/read-edid-3.0.2/parse-edid/parse-edid.c:269:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(modearray[currentmode], "%s", ceamodes[extb[5+i]&0x7F]); data/read-edid-3.0.2/parse-edid/parse-edid.c:310:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(modearray[currentmode], "%s%u %u %u %u ", modearray[currentmode], hactive, hactive+hsyncoff, hactive+hsyncoff+hsyncwidth, hactive+hblank); data/read-edid-3.0.2/parse-edid/parse-edid.c:311:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(modearray[currentmode], "%s%u %u %u %u ", modearray[currentmode], vactive, vactive+vsyncoff, vactive+vsyncoff+vsyncwidth, vactive+vblank); data/read-edid-3.0.2/parse-edid/parse-edid.c:315:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(modearray[currentmode], "%s%shsync %svsync %s", modearray[currentmode], ((extb[i+17]&0x10) && extb[i+17]&0x02) ? "+": "-", ((extb[i+17]&0x10) && extb[i+17]&0x04) ? "+": "-", (extb[i+17]&0x80) ? "interlace": ""); data/read-edid-3.0.2/get-edid/classic.c:26:41: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. #define dosmemput(buffer,length,offset) memcpy(offset,buffer,length) data/read-edid-3.0.2/get-edid/classic.c:395: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( &vbe_version, buffer+4, 2 ); data/read-edid-3.0.2/get-edid/classic.c:396: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( &oem_string_ptr, buffer+6, 4 ); data/read-edid-3.0.2/get-edid/get-edid.c:22: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 temp[128]; data/read-edid-3.0.2/get-edid/get-edid.c:37:9: [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). return atoi(temp); data/read-edid-3.0.2/get-edid/i2c.c:24: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 filename[16]; data/read-edid-3.0.2/get-edid/i2c.c:27:2: [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. sprintf(filename, "/dev/i2c-%d", i2cbus); data/read-edid-3.0.2/get-edid/i2c.c:28: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). i2cfile = open(filename, O_RDWR); data/read-edid-3.0.2/get-edid/i2c.c:32: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). i2cfile = open(filename, O_RDWR); data/read-edid-3.0.2/get-edid/i2c.c:63: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 block[256]; data/read-edid-3.0.2/parse-edid/modes.h:1: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 ceamodes[61][128] = { //Guess who had to do these by hand... you're welcome. data/read-edid-3.0.2/parse-edid/parse-edid.c:22: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 modearray[128][128]; data/read-edid-3.0.2/parse-edid/parse-edid.c:47: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 modelname[13]; data/read-edid-3.0.2/parse-edid/parse-edid.c:171:4: [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. sprintf(modearray[currentmode], "%.2f ", (double)pixclk / 100.0); data/read-edid-3.0.2/parse-edid/parse-edid.c:298:4: [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. sprintf(modearray[currentmode], "%.2f ", (double)pixclk / 100.0); data/read-edid-3.0.2/get-edid/get-edid.c:23:13: [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 (i=0;i<strlen(str);i++) { data/read-edid-3.0.2/parse-edid/parse-edid.c:349:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(infd, &edid, 128) != 128) data/read-edid-3.0.2/parse-edid/parse-edid.c:356:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(infd, &extb, 128) != 128) ANALYSIS SUMMARY: Hits = 28 Lines analyzed = 1469 in approximately 0.06 seconds (24149 lines/second) Physical Source Lines of Code (SLOC) = 1065 Hits@level = [0] 37 [1] 3 [2] 15 [3] 0 [4] 10 [5] 0 Hits@level+ = [0+] 65 [1+] 28 [2+] 25 [3+] 10 [4+] 10 [5+] 0 Hits/KSLOC@level+ = [0+] 61.0329 [1+] 26.2911 [2+] 23.4742 [3+] 9.38967 [4+] 9.38967 [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.