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/vectoroids-1.1.0/vectoroids.c FINAL RESULTS: data/vectoroids-1.1.0/vectoroids.c:599:7: [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("HOME") != NULL ) data/vectoroids-1.1.0/vectoroids.c:603:9: [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. getenv("HOME")); data/vectoroids-1.1.0/vectoroids.c:1948:3: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand(SDL_GetTicks()); data/vectoroids-1.1.0/vectoroids.c:140: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 * sound_names[NUM_SOUNDS] = { data/vectoroids-1.1.0/vectoroids.c:179: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 zoom_str[24]; data/vectoroids-1.1.0/vectoroids.c:581: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 statefile[256], buf[256]; data/vectoroids-1.1.0/vectoroids.c:606:3: [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(statefile, "vectoroids-state.dat"); data/vectoroids-1.1.0/vectoroids.c:609:8: [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). fi = fopen(statefile, "r"); data/vectoroids-1.1.0/vectoroids.c:667:8: [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). fi = fopen(statefile, "w"); data/vectoroids-1.1.0/vectoroids.c:712: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 str[20]; data/vectoroids-1.1.0/vectoroids.c:917:7: [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(str, "HIGH %.6d", high); data/vectoroids-1.1.0/vectoroids.c:924:11: [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(str, "LAST %.6d", score); data/vectoroids-1.1.0/vectoroids.c:926:11: [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(str, "SCR %.6d", score); data/vectoroids-1.1.0/vectoroids.c:1007: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 str[10]; data/vectoroids-1.1.0/vectoroids.c:1675:7: [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(str, "%.6d", score); data/vectoroids-1.1.0/vectoroids.c:1679:7: [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(str, "%.6d", score); data/vectoroids-1.1.0/vectoroids.c:1688:7: [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(str, "%d", level); data/vectoroids-1.1.0/vectoroids.c:1692:7: [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(str, "%d", level); data/vectoroids-1.1.0/vectoroids.c:2880:5: [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(zoom_str, "EXTRA LIFE"); data/vectoroids-1.1.0/vectoroids.c:2975:3: [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(zoom_str, "LEVEL %d", level); data/vectoroids-1.1.0/vectoroids.c:620:9: [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). buf[strlen(buf) - 1] = '\0'; data/vectoroids-1.1.0/vectoroids.c:629:22: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). game_pending = fgetc(fi); data/vectoroids-1.1.0/vectoroids.c:630:15: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). lives = fgetc(fi); data/vectoroids-1.1.0/vectoroids.c:631:15: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). level = fgetc(fi); data/vectoroids-1.1.0/vectoroids.c:632:22: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). player_alive = fgetc(fi); data/vectoroids-1.1.0/vectoroids.c:633:26: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). player_die_timer = fgetc(fi); data/vectoroids-1.1.0/vectoroids.c:720: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). for (i = 0; i < strlen(titlestr); i++) data/vectoroids-1.1.0/vectoroids.c:829: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). if (snapped < strlen(titlestr)) data/vectoroids-1.1.0/vectoroids.c:831: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). for (i = 0; i < strlen(titlestr); i++) data/vectoroids-1.1.0/vectoroids.c:839:39: [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 (letters[i].x > ((WIDTH - (strlen(titlestr) * 14)) / 2 + data/vectoroids-1.1.0/vectoroids.c:843:44: [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). else if (letters[i].x < ((WIDTH - (strlen(titlestr) * 14)) / 2 + data/vectoroids-1.1.0/vectoroids.c:856:40: [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 (letters[i].x >= ((WIDTH - (strlen(titlestr) * 14)) / 2 + data/vectoroids-1.1.0/vectoroids.c:858:40: [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). letters[i].x <= ((WIDTH - (strlen(titlestr) * 14)) / 2 + data/vectoroids-1.1.0/vectoroids.c:865: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). letters[i].x = ((WIDTH - (strlen(titlestr) * 14)) / 2 + (i * 14)); data/vectoroids-1.1.0/vectoroids.c:886: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). if (snapped != strlen(titlestr)) data/vectoroids-1.1.0/vectoroids.c:888:18: [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). for (i = 0; i < strlen(titlestr); i++) data/vectoroids-1.1.0/vectoroids.c:896:18: [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). for (i = 0; i < strlen(titlestr); i++) data/vectoroids-1.1.0/vectoroids.c:910: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). if (snapped == strlen(titlestr)) data/vectoroids-1.1.0/vectoroids.c:1762:34: [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). draw_text(zoom_str, (WIDTH - (strlen(zoom_str) * text_zoom)) / 2, data/vectoroids-1.1.0/vectoroids.c:1766:34: [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). draw_text(zoom_str, (WIDTH - (strlen(zoom_str) * text_zoom)) / 2, data/vectoroids-1.1.0/vectoroids.c:2930: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). for (i = 0; i < strlen(str); i++) data/vectoroids-1.1.0/vectoroids.c:3016: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). draw_text(str, (WIDTH - strlen(str) * (s + 3)) / 2, y, s, c); ANALYSIS SUMMARY: Hits = 42 Lines analyzed = 3018 in approximately 0.08 seconds (37720 lines/second) Physical Source Lines of Code (SLOC) = 2178 Hits@level = [0] 36 [1] 22 [2] 17 [3] 3 [4] 0 [5] 0 Hits@level+ = [0+] 78 [1+] 42 [2+] 20 [3+] 3 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 35.8127 [1+] 19.2837 [2+] 9.18274 [3+] 1.37741 [4+] 0 [5+] 0 Dot directories skipped = 2 (--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.