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/pacparser-1.3.6/examples/pactest.c Examining data/pacparser-1.3.6/src/pac_utils.h Examining data/pacparser-1.3.6/src/pacparser.c Examining data/pacparser-1.3.6/src/pacparser.h Examining data/pacparser-1.3.6/src/pactester.c Examining data/pacparser-1.3.6/src/pymod/pacparser_py.c FINAL RESULTS: data/pacparser-1.3.6/src/pac_utils.h:340:15: [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). tmporig = strcpy(tmporig, orig); data/pacparser-1.3.6/src/pac_utils.h:367:15: [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). tmp = strcpy(tmp, with) + len_with; data/pacparser-1.3.6/src/pac_utils.h:370: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(tmp, tmporig); data/pacparser-1.3.6/src/pacparser.c:54:10: [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. return vfprintf(stderr, fmt, argp); data/pacparser-1.3.6/src/pacparser.c:150:33: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. if (ipaddr_list[0] == '\0') sprintf(ipaddr_list, "%s", ipaddr); data/pacparser-1.3.6/src/pacparser.c:151:10: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. else sprintf(ipaddr_list, "%s;%s", ipaddr_list, ipaddr); data/pacparser-1.3.6/src/pacparser.c:176:3: [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(out, ipaddr); data/pacparser-1.3.6/src/pacparser.c:197:3: [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(out, ipaddr); data/pacparser-1.3.6/src/pacparser.c:212: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(ipaddr, myip); data/pacparser-1.3.6/src/pacparser.c:222:3: [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(out, ipaddr); data/pacparser-1.3.6/src/pacparser.c:237: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(ipaddr, myip); data/pacparser-1.3.6/src/pacparser.c:247:3: [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(out, ipaddr); data/pacparser-1.3.6/src/pacparser.c:268:3: [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(myip, ip); data/pacparser-1.3.6/src/pacparser.c:450:3: [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(script, sanitized_url); data/pacparser-1.3.6/src/pacparser.c:452:3: [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(script, host); data/pacparser-1.3.6/src/pacparser.c:520:3: [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(proxy, out); data/pacparser-1.3.6/src/pactester.c:169: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(script, buffer); data/pacparser-1.3.6/src/pacparser.c:79:6: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if(getenv("PACPARSER_DEBUG")) return 1; data/pacparser-1.3.6/src/pactester.c:85:15: [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 ((c = getopt(argc, argv, "evp:u:h:f:c:")) != -1) data/pacparser-1.3.6/src/pacparser.c:91: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 (!(fptr = fopen(filename, "r"))) goto error1; data/pacparser-1.3.6/src/pacparser.c:127: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 ipaddr[INET6_ADDRSTRLEN]; data/pacparser-1.3.6/src/pacparser.c:167: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 ipaddr[INET6_ADDRSTRLEN] = ""; data/pacparser-1.3.6/src/pacparser.c:190: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 ipaddr[INET6_ADDRSTRLEN * MAX_IP_RESULTS + MAX_IP_RESULTS] = ""; data/pacparser-1.3.6/src/pacparser.c:208: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 ipaddr[INET6_ADDRSTRLEN]; data/pacparser-1.3.6/src/pacparser.c:214: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 name[256]; data/pacparser-1.3.6/src/pacparser.c:217:7: [2] (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). Risk is low because the source is a constant string. strcpy(ipaddr, "127.0.0.1"); data/pacparser-1.3.6/src/pacparser.c:233: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 ipaddr[INET6_ADDRSTRLEN * MAX_IP_RESULTS + MAX_IP_RESULTS]; data/pacparser-1.3.6/src/pacparser.c:239: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 name[256]; data/pacparser-1.3.6/src/pacparser.c:449:3: [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(script, "FindProxyForURL('"); data/pacparser-1.3.6/src/pacparser.c:451:3: [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(script, "', '"); data/pacparser-1.3.6/src/pacparser.c:453:3: [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(script, "')"); data/pacparser-1.3.6/src/pactester.c:144: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 buffer[buffsize]; data/pacparser-1.3.6/src/pactester.c:218: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[1000]; // this limits line length to 1000. data/pacparser-1.3.6/src/pactester.c:220: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 (!(fp = fopen(urlslist, "r"))) { data/pacparser-1.3.6/src/pac_utils.h:339:28: [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). char *tmporig = malloc(strlen(orig) + 1); // Copy of orig that we work with data/pacparser-1.3.6/src/pac_utils.h:347: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). int len_rep = strlen(rep); data/pacparser-1.3.6/src/pac_utils.h:348: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). int len_with = strlen(with); data/pacparser-1.3.6/src/pac_utils.h:356: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). tmp = result = malloc(strlen(tmporig) + (len_with - len_rep) * count + 1); data/pacparser-1.3.6/src/pac_utils.h:366:15: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). tmp = strncpy(tmp, tmporig, len_front) + len_front; data/pacparser-1.3.6/src/pacparser.c:175:23: [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). out = JS_malloc(cx, strlen(ipaddr) + 1); data/pacparser-1.3.6/src/pacparser.c:177:41: [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). JSString *str = JS_NewString(cx, out, strlen(out)); data/pacparser-1.3.6/src/pacparser.c:192:23: [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). out = JS_malloc(cx, strlen(ipaddr) + 1); data/pacparser-1.3.6/src/pacparser.c:195:5: [1] (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). Risk is low because the source is a constant character. strcpy(out, ""); data/pacparser-1.3.6/src/pacparser.c:198:41: [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). JSString *str = JS_NewString(cx, out, strlen(out)); data/pacparser-1.3.6/src/pacparser.c:221:23: [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). out = JS_malloc(cx, strlen(ipaddr) + 1); data/pacparser-1.3.6/src/pacparser.c:223:41: [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). JSString *str = JS_NewString(cx, out, strlen(out)); data/pacparser-1.3.6/src/pacparser.c:242:7: [1] (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). Risk is low because the source is a constant character. strcpy(ipaddr, ""); data/pacparser-1.3.6/src/pacparser.c:246:23: [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). out = JS_malloc(cx, strlen(ipaddr) + 1); data/pacparser-1.3.6/src/pacparser.c:248:41: [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). JSString *str = JS_NewString(cx, out, strlen(out)); data/pacparser-1.3.6/src/pacparser.c:267:17: [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). myip = malloc(strlen(ip) +1); // Allocate space just to be sure. data/pacparser-1.3.6/src/pacparser.c:327: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). strlen(pacUtils), data/pacparser-1.3.6/src/pacparser.c:355: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). strlen(script), data/pacparser-1.3.6/src/pacparser.c:431:41: [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). JS_EvaluateScript(cx, global, script, strlen(script), NULL, 1, &rval); data/pacparser-1.3.6/src/pacparser.c:447:32: [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). script = (char*) malloc(32 + strlen(url) + strlen(host)); data/pacparser-1.3.6/src/pacparser.c:447:46: [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). script = (char*) malloc(32 + strlen(url) + strlen(host)); data/pacparser-1.3.6/src/pacparser.c:455:46: [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 (!JS_EvaluateScript(cx, global, script, strlen(script), NULL, 1, &rval)) { data/pacparser-1.3.6/src/pacparser.c:519: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). proxy = (char*) malloc(strlen(out) + 1); data/pacparser-1.3.6/src/pactester.c:154: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(buffer) == 0) break; data/pacparser-1.3.6/src/pactester.c:156:22: [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). script_size += strlen(buffer); ANALYSIS SUMMARY: Hits = 59 Lines analyzed = 1490 in approximately 0.07 seconds (20105 lines/second) Physical Source Lines of Code (SLOC) = 1085 Hits@level = [0] 28 [1] 25 [2] 15 [3] 2 [4] 17 [5] 0 Hits@level+ = [0+] 87 [1+] 59 [2+] 34 [3+] 19 [4+] 17 [5+] 0 Hits/KSLOC@level+ = [0+] 80.1843 [1+] 54.3779 [2+] 31.3364 [3+] 17.5115 [4+] 15.6682 [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.