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/cbp2make-147+dfsg/lib/stringhash.h Examining data/cbp2make-147+dfsg/lib/stlconfig.cpp Examining data/cbp2make-147+dfsg/lib/stringhash.cpp Examining data/cbp2make-147+dfsg/lib/stlgpm.h Examining data/cbp2make-147+dfsg/lib/stlconvert.h Examining data/cbp2make-147+dfsg/lib/stlvariables.h Examining data/cbp2make-147+dfsg/lib/stlstrings.h Examining data/cbp2make-147+dfsg/lib/stlconvert.cpp Examining data/cbp2make-147+dfsg/lib/stlstrings.cpp Examining data/cbp2make-147+dfsg/lib/stlfutils.cpp Examining data/cbp2make-147+dfsg/lib/stlgpm.cpp Examining data/cbp2make-147+dfsg/lib/stlfutils.h Examining data/cbp2make-147+dfsg/lib/stlvariables.cpp Examining data/cbp2make-147+dfsg/lib/macros.h Examining data/cbp2make-147+dfsg/lib/stlconfig.h Examining data/cbp2make-147+dfsg/src/cbproject.cpp Examining data/cbp2make-147+dfsg/src/depsearch.h Examining data/cbp2make-147+dfsg/src/cbptarget.cpp Examining data/cbp2make-147+dfsg/src/buildtools.cpp Examining data/cbp2make-147+dfsg/src/cbp2make.cpp Examining data/cbp2make-147+dfsg/src/cbptarget.h Examining data/cbp2make-147+dfsg/src/makefile.h Examining data/cbp2make-147+dfsg/src/cbworkspace.cpp Examining data/cbp2make-147+dfsg/src/platforms.h Examining data/cbp2make-147+dfsg/src/toolchains.cpp Examining data/cbp2make-147+dfsg/src/cbpunit.cpp Examining data/cbp2make-147+dfsg/src/cbpunit.h Examining data/cbp2make-147+dfsg/src/cbhelper.h Examining data/cbp2make-147+dfsg/src/buildtools.h Examining data/cbp2make-147+dfsg/src/cbglobalvar.cpp Examining data/cbp2make-147+dfsg/src/cbproject.h Examining data/cbp2make-147+dfsg/src/platforms.cpp Examining data/cbp2make-147+dfsg/src/cbbuildmgr.h Examining data/cbp2make-147+dfsg/src/cbworkspace.h Examining data/cbp2make-147+dfsg/src/depsearch.cpp Examining data/cbp2make-147+dfsg/src/cbhelper.cpp Examining data/cbp2make-147+dfsg/src/cbglobalvar.h Examining data/cbp2make-147+dfsg/src/cbbuildmgr.cpp Examining data/cbp2make-147+dfsg/src/toolchains.h Examining data/cbp2make-147+dfsg/src/cbbuildcfg.h Examining data/cbp2make-147+dfsg/src/revision.h Examining data/cbp2make-147+dfsg/src/cbbuildcfg.cpp Examining data/cbp2make-147+dfsg/src/makefile.cpp FINAL RESULTS: data/cbp2make-147+dfsg/lib/stlconvert.h:176:2: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(result.GetCString(),Format.GetCString(),Value); data/cbp2make-147+dfsg/lib/stlfutils.cpp:268:11: [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. result = getenv("SystemDrive"); data/cbp2make-147+dfsg/lib/stlfutils.cpp:284:11: [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. result = getenv("USERPROFILE"); data/cbp2make-147+dfsg/lib/stlfutils.cpp:287:20: [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. result = CString(getenv("HOMEDRIVE"))+CString(getenv("HOMEPATH")); data/cbp2make-147+dfsg/lib/stlfutils.cpp:287:49: [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. result = CString(getenv("HOMEDRIVE"))+CString(getenv("HOMEPATH")); data/cbp2make-147+dfsg/lib/stlfutils.cpp:290:13: [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. result = getenv("HOME"); data/cbp2make-147+dfsg/lib/stlfutils.cpp:296:11: [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. result = getenv("HOME"); data/cbp2make-147+dfsg/lib/stlfutils.cpp:319:11: [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. result = getenv("TMPDIR"); data/cbp2make-147+dfsg/lib/stlconfig.cpp:254:17: [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). FILE *stream = fopen(FileName.GetCString(),"wt"); data/cbp2make-147+dfsg/lib/stlfutils.cpp:224:17: [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). FILE* stream = fopen(FileName.GetCString(),"r"); data/cbp2make-147+dfsg/lib/stlfutils.cpp:309: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 tmp[MAX_PATH_LENGTH]; data/cbp2make-147+dfsg/lib/stlstrings.cpp:206: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 buffer[MAX_SHORTSTRING_LENGTH]; data/cbp2make-147+dfsg/lib/stlstrings.cpp:207: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(buffer,"%d",AInteger); data/cbp2make-147+dfsg/lib/stlstrings.cpp:214: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 buffer[MAX_SHORTSTRING_LENGTH]; data/cbp2make-147+dfsg/lib/stlstrings.cpp:215: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(buffer,"%lld",AInteger); data/cbp2make-147+dfsg/lib/stlstrings.cpp:222: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 buffer[MAX_SHORTSTRING_LENGTH]; data/cbp2make-147+dfsg/lib/stlstrings.cpp:223: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(buffer,"%e",AFloat); data/cbp2make-147+dfsg/lib/stlstrings.cpp:230: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 buffer[MAX_SHORTSTRING_LENGTH]; data/cbp2make-147+dfsg/lib/stlstrings.cpp:231: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(buffer,"%le",AFloat); data/cbp2make-147+dfsg/lib/stlstrings.cpp:253: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 buffer[MAX_SHORTSTRING_LENGTH]; data/cbp2make-147+dfsg/lib/stlstrings.cpp:254: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(buffer,"%d",AInteger); data/cbp2make-147+dfsg/lib/stlstrings.cpp:261: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 buffer[MAX_SHORTSTRING_LENGTH]; data/cbp2make-147+dfsg/lib/stlstrings.cpp:262: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(buffer,"%lld",AInteger); data/cbp2make-147+dfsg/lib/stlstrings.cpp:269: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 buffer[MAX_SHORTSTRING_LENGTH]; data/cbp2make-147+dfsg/lib/stlstrings.cpp:270: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(buffer,"%e",AFloat); data/cbp2make-147+dfsg/lib/stlstrings.cpp:277: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 buffer[MAX_SHORTSTRING_LENGTH]; data/cbp2make-147+dfsg/lib/stlstrings.cpp:278: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(buffer,"%le",AFloat); data/cbp2make-147+dfsg/lib/stlstrings.cpp:300: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(GetCString()); data/cbp2make-147+dfsg/lib/stlstrings.cpp:538:17: [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). FILE* stream = fopen(FileName.GetCString(),"rb"); data/cbp2make-147+dfsg/lib/stlstrings.cpp:592:17: [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). FILE* stream = fopen(FileName.GetCString(),"wb"); data/cbp2make-147+dfsg/lib/stlstrings.h:285: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. static const char HEX_CHARS_UCASE[17] = "0123456789ABCDEF"; data/cbp2make-147+dfsg/lib/stlstrings.h:286: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. static const char HEX_CHARS_LCASE[17] = "0123456789abcdef"; data/cbp2make-147+dfsg/lib/stlstrings.cpp:55:19: [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). return SetLength(strlen(GetCString())); ANALYSIS SUMMARY: Hits = 33 Lines analyzed = 16014 in approximately 0.39 seconds (40903 lines/second) Physical Source Lines of Code (SLOC) = 13020 Hits@level = [0] 1 [1] 1 [2] 24 [3] 7 [4] 1 [5] 0 Hits@level+ = [0+] 34 [1+] 33 [2+] 32 [3+] 8 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 2.61137 [1+] 2.53456 [2+] 2.45776 [3+] 0.614439 [4+] 0.0768049 [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.