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/togl-2.0/double.c Examining data/togl-2.0/gears.c Examining data/togl-2.0/image.c Examining data/togl-2.0/image.h Examining data/togl-2.0/index.c Examining data/togl-2.0/overlay.c Examining data/togl-2.0/stereo.c Examining data/togl-2.0/StereoI/StereoI.h Examining data/togl-2.0/texture.c Examining data/togl-2.0/togl.c Examining data/togl-2.0/togl.h Examining data/togl-2.0/toglDecls.h Examining data/togl-2.0/toglFont.c Examining data/togl-2.0/toglProcAddr.c Examining data/togl-2.0/toglpy.h Examining data/togl-2.0/toglStubInit.c Examining data/togl-2.0/toglStubLib.c FINAL RESULTS: data/togl-2.0/togl.c:57:31: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. # define StringCchPrintf snprintf data/togl-2.0/toglFont.c:30:10: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. # define snprintf _snprintf data/togl-2.0/toglFont.c:30:19: [4] (format) _snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. # define snprintf _snprintf data/togl-2.0/toglFont.c:93:2: [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(obj->bytes, buf); data/togl-2.0/togl.c:3170:32: [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 ((autostereod = getenv("AUTOSTEREOD")) == NULL) data/togl-2.0/gears.c:418: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 Result[100]; data/togl-2.0/gears.c:433:5: [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(Result, "%g %g", Wg->Roty, Wg->Rotx); data/togl-2.0/image.c:33: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[80]; data/togl-2.0/image.c:81:9: [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 testByte[4]; data/togl-2.0/image.c:99:22: [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 ((raw->file = fopen(fileName, "rb")) == NULL) { data/togl-2.0/togl.c:728:23: [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 unsigned char threeto8[8] = { data/togl-2.0/togl.c:732:23: [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 unsigned char twoto8[4] = { data/togl-2.0/togl.c:736:23: [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 unsigned char oneto8[2] = { data/togl-2.0/toglFont.c:80:9: [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 char buf[256]; data/togl-2.0/toglFont.c:249: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 typeTable[256]; /* Table that identfies all lead bytes for a data/togl-2.0/toglFont.c:255: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 *fontMap[FONTMAP_PAGES]; data/togl-2.0/toglProcAddr.c:33: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 buf[256]; data/togl-2.0/toglProcAddr.c:36:5: [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(buf, "_%.*s", (int) sizeof buf - 1, funcname); data/togl-2.0/toglFont.c:91: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(buf); data/togl-2.0/toglFont.c:435: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(str); ANALYSIS SUMMARY: Hits = 20 Lines analyzed = 8283 in approximately 0.19 seconds (44139 lines/second) Physical Source Lines of Code (SLOC) = 5979 Hits@level = [0] 25 [1] 2 [2] 13 [3] 1 [4] 4 [5] 0 Hits@level+ = [0+] 45 [1+] 20 [2+] 18 [3+] 5 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 7.52634 [1+] 3.34504 [2+] 3.01054 [3+] 0.83626 [4+] 0.669008 [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.