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/bumprace-1.5.7/macosx/SDLMain.h Examining data/bumprace-1.5.7/src/bumprace.c Examining data/bumprace-1.5.7/src/bumprace.h Examining data/bumprace-1.5.7/src/font.c Examining data/bumprace-1.5.7/src/font.h Examining data/bumprace-1.5.7/src/gfx.c Examining data/bumprace-1.5.7/src/gfx.h Examining data/bumprace-1.5.7/src/levels.h Examining data/bumprace-1.5.7/src/levels2.h Examining data/bumprace-1.5.7/src/menu.c Examining data/bumprace-1.5.7/src/menu.h Examining data/bumprace-1.5.7/src/options.c Examining data/bumprace-1.5.7/src/options.h Examining data/bumprace-1.5.7/src/particles.c Examining data/bumprace-1.5.7/src/particles.h FINAL RESULTS: data/bumprace-1.5.7/src/bumprace.c:1074:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(text,"BumpRace Version %s (C) 2007 Karl Bartel", VERSION); data/bumprace-1.5.7/src/bumprace.c:1140:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(text,"%s/sound/Flying_me_softly.ogg",DATAPATH); data/bumprace-1.5.7/src/bumprace.c:1145:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(text,"%s/sound/%s",DATAPATH,"explosion1.ogg"); data/bumprace-1.5.7/src/bumprace.c:1147:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(text,"%s/sound/%s",DATAPATH,"Picked_Coin_Echo_2.ogg"); data/bumprace-1.5.7/src/bumprace.c:1149:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(text,"%s/sound/%s",DATAPATH,"Menu_Select_01.ogg"); data/bumprace-1.5.7/src/bumprace.c:1178:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(text,"%s/font.scl",DATAPATH); data/bumprace-1.5.7/src/font.c:216:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(text,"%s%c",text,ch); data/bumprace-1.5.7/src/gfx.c:320:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(filename,"%s/gfx/%s",DATAPATH,datafile); data/bumprace-1.5.7/src/gfx.c:323:5: [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(DATAPATH,PATH[i]); data/bumprace-1.5.7/src/gfx.c:324:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(filename,"%s/gfx/%s",DATAPATH,datafile); data/bumprace-1.5.7/src/options.c:87:3: [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(Player[a],Player[a-1]); data/bumprace-1.5.7/src/options.c:91:6: [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(Player[i],Name); data/bumprace-1.5.7/src/options.c:135:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(text,"%s", Player[i]); data/bumprace-1.5.7/src/bumprace.c:1166: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( (unsigned) time(NULL) ); data/bumprace-1.5.7/src/options.c:14:17: [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 ((char *)getenv("HOME") != NULL) data/bumprace-1.5.7/src/options.c:15:57: [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. snprintf( filename, sizeof(filename), "%s/.bumprace", getenv("HOME")); data/bumprace-1.5.7/src/bumprace.c:63:8: [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 modname[20]="lizard.mod"; data/bumprace-1.5.7/src/bumprace.c:78:8: [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 finished[28]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; // is level number X finished (1 or 0) data/bumprace-1.5.7/src/bumprace.c:86:8: [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 text[200]; data/bumprace-1.5.7/src/bumprace.c:683: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(text,"%2d %2d",user[0].points,user[1].points); data/bumprace-1.5.7/src/bumprace.c:870: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(text,"fore%d.png",i+1); data/bumprace-1.5.7/src/bumprace.c:875: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(text,"fore%d.gif",i+1); data/bumprace-1.5.7/src/bumprace.c:880: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(text,"cannon%d.jpg",i+1); data/bumprace-1.5.7/src/bumprace.c:885: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(text,"star%d.gif",i+1); data/bumprace-1.5.7/src/bumprace.c:890: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(text,"laser%d.png",i+1); data/bumprace-1.5.7/src/bumprace.c:925:22: [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). {i++;precision=atoi(argv[i]);printf("Precision is set to %d\n",precision);} else data/bumprace-1.5.7/src/bumprace.c:927:21: [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). {i++;levelset=atoi(argv[i]);printf("Levelset is set to %d\n",levelset);} else data/bumprace-1.5.7/src/bumprace.c:973: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(text, "and %d points for the time that is left,", lifetime/3000); data/bumprace-1.5.7/src/bumprace.c:976: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(text, "You are in Stage %d now", ++Stage); data/bumprace-1.5.7/src/bumprace.c:978: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(text, "Your current score is %d", Score+=200+lifetime/3000); data/bumprace-1.5.7/src/bumprace.c:1010: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(text,"BumpRace: Level #%d",levelnum); data/bumprace-1.5.7/src/bumprace.c:1096: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(text, "%d levels completed", user[0].points); data/bumprace-1.5.7/src/bumprace.c:1098: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(text,"%d levels completed",user[1].points); data/bumprace-1.5.7/src/bumprace.c:1100:40: [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. if (user[0].points>user[1].points) sprintf(text,"Player 1 has won!"); data/bumprace-1.5.7/src/bumprace.c:1101:42: [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. else if (user[0].points<user[1].points) sprintf(text,"Player 2 has won!"); data/bumprace-1.5.7/src/bumprace.c:1102:15: [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. else sprintf(text,"Draw Game!"); data/bumprace-1.5.7/src/bumprace.c:1202: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(text,"BumpRace: Level #%d",levelnum); data/bumprace-1.5.7/src/bumprace.h:54:8: [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. extern char text[200]; data/bumprace-1.5.7/src/gfx.c:12: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 DATAPATH[200]=DATADIR; data/bumprace-1.5.7/src/gfx.c:13:7: [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. const char PATH[PATHNUM][200]={DATADIR,".","data","/usr/local/share/bumprace" data/bumprace-1.5.7/src/gfx.c:317: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 filename[200]; data/bumprace-1.5.7/src/gfx.h:6:8: [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. extern char DATAPATH[200]; data/bumprace-1.5.7/src/menu.c:218: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(text,"racerc%d.gif",i+1); data/bumprace-1.5.7/src/menu.c:225: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(text,"racerd%d.gif",i+1); data/bumprace-1.5.7/src/menu.c:232: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(text,"racere%d.gif",i+1); data/bumprace-1.5.7/src/menu.c:239: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(text,"racerf%d.gif",i+1); data/bumprace-1.5.7/src/options.c:6: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 Player[10][200]; data/bumprace-1.5.7/src/options.c:11: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 filename[200]; data/bumprace-1.5.7/src/options.c:17: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( filename, "bumprace.dat"); data/bumprace-1.5.7/src/options.c:19: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). file = fopen(filename, mode); data/bumprace-1.5.7/src/options.c:68: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[200]="",text[200]; data/bumprace-1.5.7/src/options.c:75: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(text,"%d", Score); data/bumprace-1.5.7/src/options.c:82:29: [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. if (strcmp(Name,"")==0) strcpy(Name,"Anonymous Coward"); data/bumprace-1.5.7/src/options.c:116: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(text,"%d", Score); data/bumprace-1.5.7/src/options.c:129: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 text[200]; data/bumprace-1.5.7/src/options.c:137: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(text,"%d", Hiscore[i]); data/bumprace-1.5.7/src/font.c:213:33: [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 ((sym==SDLK_BACKSPACE)&&(strlen(text)>0)) data/bumprace-1.5.7/src/font.c:214:11: [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). text[strlen(text)-1]='\0'; data/bumprace-1.5.7/src/font.c:217:54: [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 (SFont_TextWidth2(Font,text)>PixelWidth) text[strlen(text)-1]='\0'; data/bumprace-1.5.7/src/font.c:242:10: [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). text[strlen(text)]='\0'; ANALYSIS SUMMARY: Hits = 60 Lines analyzed = 3350 in approximately 0.23 seconds (14696 lines/second) Physical Source Lines of Code (SLOC) = 2763 Hits@level = [0] 54 [1] 4 [2] 40 [3] 3 [4] 13 [5] 0 Hits@level+ = [0+] 114 [1+] 60 [2+] 56 [3+] 16 [4+] 13 [5+] 0 Hits/KSLOC@level+ = [0+] 41.2595 [1+] 21.7155 [2+] 20.2678 [3+] 5.79081 [4+] 4.70503 [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.