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/vodovod-1.10/menu.cpp Examining data/vodovod-1.10/effects.cpp Examining data/vodovod-1.10/sutils.h Examining data/vodovod-1.10/resource.cpp Examining data/vodovod-1.10/map.h Examining data/vodovod-1.10/hiscore.h Examining data/vodovod-1.10/SDL_main.c Examining data/vodovod-1.10/config.h Examining data/vodovod-1.10/game.h Examining data/vodovod-1.10/njamfont.h Examining data/vodovod-1.10/keys.h Examining data/vodovod-1.10/menu.h Examining data/vodovod-1.10/effects.h Examining data/vodovod-1.10/keys.cpp Examining data/vodovod-1.10/allmenus.h Examining data/vodovod-1.10/allmenus.cpp Examining data/vodovod-1.10/game.cpp Examining data/vodovod-1.10/main.cpp Examining data/vodovod-1.10/map.cpp Examining data/vodovod-1.10/resource.h Examining data/vodovod-1.10/sutils.cpp Examining data/vodovod-1.10/config.cpp Examining data/vodovod-1.10/hiscore.cpp Examining data/vodovod-1.10/njamfont.cpp FINAL RESULTS: data/vodovod-1.10/config.cpp:171:5: [5] (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 high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat(vodovod_conf, "/vodovod.conf", sizeof(vodovod_conf)); data/vodovod-1.10/hiscore.cpp:127:5: [5] (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 high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat(hiscore_dat, "/hiscore.dat", sizeof(hiscore_dat)); data/vodovod-1.10/SDL_main.c:294:2: [4] (buffer) wcscpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using a function version that stops copying at the end of the buffer. wcscpy (bufp, TEXT("\"")); data/vodovod-1.10/SDL_main.c:296:2: [4] (buffer) wcscpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using a function version that stops copying at the end of the buffer. wcscpy (bufp+wcslen(bufp), TEXT("\" ")); data/vodovod-1.10/SDL_main.c:311: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(cmdline, bufp); data/vodovod-1.10/allmenus.cpp:153:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buffer, "%2d %-20s %3d %8d", i, (*it).name.c_str(), (*it).level, (*it).points); data/vodovod-1.10/njamfont.cpp:40:9: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf((const char *)SDL_GetError(),"%s"); data/vodovod-1.10/njamfont.cpp:136:21: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf((const char *)SDL_GetError(),"%s"); data/vodovod-1.10/SDL_main.c:258:11: [3] (misc) LoadLibrary: Ensure that the full path to the library is specified, or current directory may be used (CWE-829, CWE-20). Use registry entry or GetWindowsDirectory to find library path, if you aren't already. handle = LoadLibrary(TEXT("DDRAW.DLL")); data/vodovod-1.10/config.cpp:165:18: [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. char *home = getenv("HOME"); data/vodovod-1.10/config.cpp:193:18: [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. char *home = getenv("HOME"); data/vodovod-1.10/hiscore.cpp:56:18: [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. char *home = getenv("HOME"); data/vodovod-1.10/hiscore.cpp:121:18: [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. char *home = getenv("HOME"); data/vodovod-1.10/SDL_main.c:141: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). file = fopen(STDOUT_FILE, "rb"); data/vodovod-1.10/SDL_main.c:149: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). file = fopen(STDERR_FILE, "rb"); data/vodovod-1.10/SDL_main.c:268:12: [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). stdout = fopen(STDOUT_FILE, "w"); data/vodovod-1.10/SDL_main.c:270:11: [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). newfp = fopen(STDOUT_FILE, "w"); data/vodovod-1.10/SDL_main.c:279:12: [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). stderr = fopen(STDERR_FILE, "w"); data/vodovod-1.10/SDL_main.c:281:11: [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). newfp = fopen(STDERR_FILE, "w"); data/vodovod-1.10/allmenus.cpp:152: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 buffer[80]; data/vodovod-1.10/config.cpp:162: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 vodovod_conf[1024]; data/vodovod-1.10/config.cpp:190: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 vodovod_conf[1024]; data/vodovod-1.10/effects.cpp:83: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[30]; data/vodovod-1.10/effects.cpp:84: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(buffer, "%d", pointsM); data/vodovod-1.10/game.cpp:91: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[20]; data/vodovod-1.10/game.cpp:92: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(buffer, "LEVEL %d", currentLevelM); data/vodovod-1.10/game.cpp:196: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[30]; data/vodovod-1.10/game.cpp:197: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(buffer, "LEVEL: %8d", currentLevelM); data/vodovod-1.10/game.cpp:199: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(buffer, "POINTS: %8d", pointsM); data/vodovod-1.10/game.cpp:201: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(buffer, "PIPES LEFT: %4d", pipesLeftM); data/vodovod-1.10/game.cpp:309: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[30]; data/vodovod-1.10/hiscore.cpp:53: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 hiscore_dat[1024]; data/vodovod-1.10/hiscore.cpp:63: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). FILE *fp = fopen(hiscore_dat, "r"); data/vodovod-1.10/hiscore.cpp:77: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 buff[80]; data/vodovod-1.10/hiscore.cpp:99:26: [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). int points = atoi(buff+last); data/vodovod-1.10/hiscore.cpp:107:25: [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). int level = atoi(buff+last); data/vodovod-1.10/hiscore.cpp:118: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 hiscore_dat[1024]; data/vodovod-1.10/hiscore.cpp:132: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). FILE *fp = fopen(hiscore_dat, "w+"); data/vodovod-1.10/SDL_main.c:143:12: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). empty = (fgetc(file) == EOF) ? 1 : 0; data/vodovod-1.10/SDL_main.c:151:12: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). empty = (fgetc(file) == EOF) ? 1 : 0; data/vodovod-1.10/SDL_main.c:181:7: [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). n = strlen(appname); data/vodovod-1.10/SDL_main.c:189:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(bufp, appname, n); data/vodovod-1.10/SDL_main.c:292:9: [1] (buffer) wcslen: 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). nLen = wcslen(szCmdLine)+128+1; data/vodovod-1.10/SDL_main.c:296:15: [1] (buffer) wcslen: 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). wcscpy (bufp+wcslen(bufp), TEXT("\" ")); data/vodovod-1.10/SDL_main.c:297:2: [1] (buffer) wcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). wcsncpy(bufp+wcslen(bufp), szCmdLine,nLen-wcslen(bufp)); data/vodovod-1.10/SDL_main.c:297:15: [1] (buffer) wcslen: 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). wcsncpy(bufp+wcslen(bufp), szCmdLine,nLen-wcslen(bufp)); data/vodovod-1.10/SDL_main.c:297:44: [1] (buffer) wcslen: 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). wcsncpy(bufp+wcslen(bufp), szCmdLine,nLen-wcslen(bufp)); data/vodovod-1.10/SDL_main.c:298:9: [1] (buffer) wcslen: 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). nLen = wcslen(bufp)+1; data/vodovod-1.10/SDL_main.c:307: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). cmdline = (char *)alloca(strlen(bufp)+1); ANALYSIS SUMMARY: Hits = 49 Lines analyzed = 4135 in approximately 0.15 seconds (27796 lines/second) Physical Source Lines of Code (SLOC) = 3057 Hits@level = [0] 53 [1] 11 [2] 25 [3] 5 [4] 6 [5] 2 Hits@level+ = [0+] 102 [1+] 49 [2+] 38 [3+] 13 [4+] 8 [5+] 2 Hits/KSLOC@level+ = [0+] 33.366 [1+] 16.0288 [2+] 12.4305 [3+] 4.25254 [4+] 2.61694 [5+] 0.654236 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.