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/corkscrew-2.0/acconfig.h Examining data/corkscrew-2.0/corkscrew.c FINAL RESULTS: data/corkscrew-2.0/corkscrew.c:268:6: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. sscanf(buffer,"%s%d%[^\n]",version,&code,descr); data/corkscrew-2.0/corkscrew.c:44:14: [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. const static char base64[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; data/corkscrew-2.0/corkscrew.c:175: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 uri[BUFSIZE] = "", buffer[BUFSIZE] = "", version[BUFSIZE] = "", descr[BUFSIZE] = ""; data/corkscrew-2.0/corkscrew.c:177: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 uri[BUFSIZE], buffer[BUFSIZE], version[BUFSIZE], descr[BUFSIZE]; data/corkscrew-2.0/corkscrew.c:202:9: [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). fp = fopen(argv[5], "r"); data/corkscrew-2.0/corkscrew.c:207: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 line[4096]; data/corkscrew-2.0/corkscrew.c:61: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). len = strlen(in); data/corkscrew-2.0/corkscrew.c:65: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(in); data/corkscrew-2.0/corkscrew.c:228:2: [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(uri, "CONNECT ", sizeof(uri)); data/corkscrew-2.0/corkscrew.c:229:2: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(uri, desthost, sizeof(uri) - strlen(uri) - 1); data/corkscrew-2.0/corkscrew.c:229:39: [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). strncat(uri, desthost, sizeof(uri) - strlen(uri) - 1); data/corkscrew-2.0/corkscrew.c:230:2: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant character. strncat(uri, ":", sizeof(uri) - strlen(uri) - 1); data/corkscrew-2.0/corkscrew.c:230: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). strncat(uri, ":", sizeof(uri) - strlen(uri) - 1); data/corkscrew-2.0/corkscrew.c:231:2: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(uri, destport, sizeof(uri) - strlen(uri) - 1); data/corkscrew-2.0/corkscrew.c:231:39: [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). strncat(uri, destport, sizeof(uri) - strlen(uri) - 1); data/corkscrew-2.0/corkscrew.c:232:2: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant string. strncat(uri, " HTTP/1.0", sizeof(uri) - strlen(uri) - 1); data/corkscrew-2.0/corkscrew.c:232: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). strncat(uri, " HTTP/1.0", sizeof(uri) - strlen(uri) - 1); data/corkscrew-2.0/corkscrew.c:234:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant string. strncat(uri, "\nProxy-Authorization: Basic ", sizeof(uri) - strlen(uri) - 1); data/corkscrew-2.0/corkscrew.c:234:63: [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). strncat(uri, "\nProxy-Authorization: Basic ", sizeof(uri) - strlen(uri) - 1); data/corkscrew-2.0/corkscrew.c:235:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(uri, base64_encode(up), sizeof(uri) - strlen(uri) - 1); data/corkscrew-2.0/corkscrew.c:235:49: [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). strncat(uri, base64_encode(up), sizeof(uri) - strlen(uri) - 1); data/corkscrew-2.0/corkscrew.c:237:2: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(uri, linefeed, sizeof(uri) - strlen(uri) - 1); data/corkscrew-2.0/corkscrew.c:237:39: [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). strncat(uri, linefeed, sizeof(uri) - strlen(uri) - 1); data/corkscrew-2.0/corkscrew.c:264:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). len = read(csock, buffer, sizeof(buffer)); data/corkscrew-2.0/corkscrew.c:280: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). write(1, tmp, strlen(tmp)); data/corkscrew-2.0/corkscrew.c:285:29: [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 = write(csock, uri, strlen(uri)); data/corkscrew-2.0/corkscrew.c:293:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). len = read(csock, buffer, sizeof(buffer)); data/corkscrew-2.0/corkscrew.c:300:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). len = read(0, buffer, sizeof(buffer)); ANALYSIS SUMMARY: Hits = 28 Lines analyzed = 310 in approximately 0.05 seconds (6480 lines/second) Physical Source Lines of Code (SLOC) = 271 Hits@level = [0] 7 [1] 22 [2] 5 [3] 0 [4] 1 [5] 0 Hits@level+ = [0+] 35 [1+] 28 [2+] 6 [3+] 1 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 129.151 [1+] 103.321 [2+] 22.1402 [3+] 3.69004 [4+] 3.69004 [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.