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/squidview-0.86/squidview.h Examining data/squidview-0.86/squidview.cpp FINAL RESULTS: data/squidview-0.86/squidview.cpp:236:7: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if (system ((sCommand + " 2>/dev/null").c_str()) == 0) data/squidview-0.86/squidview.cpp:251:7: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if (system (sCommand.c_str())) data/squidview-0.86/squidview.cpp:5466:11: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. return (access (file.c_str(), F_OK) == 0); data/squidview-0.86/squidview.cpp:5472:11: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. return (access (file.c_str(), R_OK) == 0); data/squidview-0.86/squidview.cpp:5484:12: [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. szTemp = getenv ("HOME"); data/squidview-0.86/squidview.cpp:200:10: [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). return open (szFilename, O_RDONLY | O_LARGEFILE); data/squidview-0.86/squidview.cpp:202:10: [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). return open (szFilename, O_RDONLY); data/squidview-0.86/squidview.cpp:278: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 szTemp [20] = ""; data/squidview-0.86/squidview.cpp:677: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 szTemp [20]; data/squidview-0.86/squidview.cpp:766: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 szTemp [80]; data/squidview-0.86/squidview.cpp:799: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 szTemp [nInputLen]; data/squidview-0.86/squidview.cpp:891: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 szTemp [nInputLen]; data/squidview-0.86/squidview.cpp:964:11: [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). iFile = open (sWordFile.c_str(), O_RDONLY); data/squidview-0.86/squidview.cpp:1004:13: [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). fOutput = fopen (sWordFile.c_str(), "w"); data/squidview-0.86/squidview.cpp:1093:11: [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). iFile = open (sAliasesFile.c_str(), O_RDONLY); data/squidview-0.86/squidview.cpp:1201:11: [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). iFile = open (sUsersFile.c_str(), O_RDONLY); data/squidview-0.86/squidview.cpp:1317:11: [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). iSize = atoi (sTemp.c_str()); data/squidview-0.86/squidview.cpp:1374:16: [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). iHitNumber = atoi (sRight.c_str()); data/squidview-0.86/squidview.cpp:1790:17: [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). iTemp = atoi (sTemp.c_str()); data/squidview-0.86/squidview.cpp:1811:17: [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). iTemp = atoi (sTemp.c_str()); data/squidview-0.86/squidview.cpp:2169: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). fOutput = fopen (string (sPathToFiles + "/" + sRepFileName) data/squidview-0.86/squidview.cpp:2403:17: [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). iFile = open (sUsersFile.c_str(), O_RDONLY); data/squidview-0.86/squidview.cpp:2626:13: [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). iTemp = atoi (sTemp.c_str()); data/squidview-0.86/squidview.cpp:2811:9: [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). iIn = open (string (sPathToFiles + "/" + sSrc).c_str(), O_RDONLY); data/squidview-0.86/squidview.cpp:2816: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). iOut = open (string (sPathToFiles + "/" + sDest).c_str(), data/squidview-0.86/squidview.cpp:3113:17: [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). iTemp = atoi (sTemp.c_str()); data/squidview-0.86/squidview.cpp:3584:10: [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). iDay = atoi (sBuffer.c_str()); data/squidview-0.86/squidview.cpp:3634:10: [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). iDay = atoi (sBuffer.c_str()); data/squidview-0.86/squidview.cpp:3832: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). fIO = fopen (sSetFileName.c_str(), "w"); data/squidview-0.86/squidview.cpp:3854:11: [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). iFile = open (sSetFileName.c_str(), O_RDONLY); data/squidview-0.86/squidview.cpp:3947:17: [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). iVariable = atoi (sLoadValue.c_str()); data/squidview-0.86/squidview.cpp:3953: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 szTemp [32]; data/squidview-0.86/squidview.cpp:5233:11: [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). iFile = open (sUsersFile.c_str(), O_RDONLY); data/squidview-0.86/squidview.h:96: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 cDiskBuffer [nReadBuffer +8]; // buffer for log read data/squidview-0.86/squidview.cpp:91: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). const int length = strlen(szText); data/squidview-0.86/squidview.cpp:467:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). iAvailable = read (fReadingFile, &cDiskBuffer, iBlock); data/squidview-0.86/squidview.cpp:514:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). iAvailable = read (fReadingFile, &cDiskBuffer, iBlock); data/squidview-0.86/squidview.cpp:768:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (szTemp, ctime (&iTime), sizeof (szTemp) - 1); data/squidview-0.86/squidview.cpp:771:12: [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). iCount = strlen (szTemp); data/squidview-0.86/squidview.cpp:972:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). iRead = read (iFile, &iLetter, 1); data/squidview-0.86/squidview.cpp:1102:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). iRead = read (iFile, &iLetter, 1); data/squidview-0.86/squidview.cpp:1211:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). iRead = read (iFile, &cLetter, 1); data/squidview-0.86/squidview.cpp:2411:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). iRead = read (iFile, &cLetter, 1); data/squidview-0.86/squidview.cpp:2835:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). iLen = read (iIn, &iLetter, 1); data/squidview-0.86/squidview.cpp:3866:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). iRead = read (iFile, &iLetter, 1); data/squidview-0.86/squidview.cpp:5239:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). iRead = read (iFile, &cLetter, 1); ANALYSIS SUMMARY: Hits = 46 Lines analyzed = 6103 in approximately 0.11 seconds (55062 lines/second) Physical Source Lines of Code (SLOC) = 5041 Hits@level = [0] 6 [1] 12 [2] 29 [3] 1 [4] 4 [5] 0 Hits@level+ = [0+] 52 [1+] 46 [2+] 34 [3+] 5 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 10.3154 [1+] 9.12517 [2+] 6.74469 [3+] 0.991867 [4+] 0.793493 [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.