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/xbubble-0.5.11.2/src/path_init.c Examining data/xbubble-0.5.11.2/src/utils.c Examining data/xbubble-0.5.11.2/src/utils.h Examining data/xbubble-0.5.11.2/src/rectangle.c Examining data/xbubble-0.5.11.2/src/rectangle.h Examining data/xbubble-0.5.11.2/src/cell.c Examining data/xbubble-0.5.11.2/src/cell.h Examining data/xbubble-0.5.11.2/src/loadpng.h Examining data/xbubble-0.5.11.2/src/rgba.c Examining data/xbubble-0.5.11.2/src/rgba.h Examining data/xbubble-0.5.11.2/src/frame.h Examining data/xbubble-0.5.11.2/src/init.h Examining data/xbubble-0.5.11.2/src/sprite.c Examining data/xbubble-0.5.11.2/src/sprite.h Examining data/xbubble-0.5.11.2/src/bubble.c Examining data/xbubble-0.5.11.2/src/bubble.h Examining data/xbubble-0.5.11.2/src/opponent.c Examining data/xbubble-0.5.11.2/src/opponent.h Examining data/xbubble-0.5.11.2/src/board.c Examining data/xbubble-0.5.11.2/src/board.h Examining data/xbubble-0.5.11.2/src/controls.h Examining data/xbubble-0.5.11.2/src/timer.c Examining data/xbubble-0.5.11.2/src/timer.h Examining data/xbubble-0.5.11.2/src/game.h Examining data/xbubble-0.5.11.2/src/setting.h Examining data/xbubble-0.5.11.2/src/dialog.c Examining data/xbubble-0.5.11.2/src/dialog.h Examining data/xbubble-0.5.11.2/src/screens.c Examining data/xbubble-0.5.11.2/src/screens.h Examining data/xbubble-0.5.11.2/src/gettext.h Examining data/xbubble-0.5.11.2/src/game.c Examining data/xbubble-0.5.11.2/src/xbubble.c Examining data/xbubble-0.5.11.2/src/init.c Examining data/xbubble-0.5.11.2/src/loadpng.c FINAL RESULTS: data/xbubble-0.5.11.2/src/init.c:243:5: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf( name, game_fonts[i], pixel_size ); data/xbubble-0.5.11.2/src/init.c:253:3: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf( name, SUPPLIED_FONT, pixel_size ); data/xbubble-0.5.11.2/src/init.c:438: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(copy,name); data/xbubble-0.5.11.2/src/init.c:769:7: [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(copy,line); data/xbubble-0.5.11.2/src/screens.c:147: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(pstats[i][0], gettext(player_name[mode][j])); data/xbubble-0.5.11.2/src/utils.c:62:3: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf( stderr, fmt, ap ); data/xbubble-0.5.11.2/src/utils.c:72:3: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf( stderr, fmt, ap ); data/xbubble-0.5.11.2/src/xbubble.c:338:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( app_name, _("XBubble @ %d fps v%s"), fps, VERSION ); data/xbubble-0.5.11.2/src/init.c:100:16: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. if(NULL == realpath( data_dir, abs_data_dir )){ data/xbubble-0.5.11.2/src/xbubble.c:275:16: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while (( c = getopt( argc, argv, "s:f:r:t:d:" )) != -1 ) { data/xbubble-0.5.11.2/src/xbubble.c:350: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( tv.tv_usec ); data/xbubble-0.5.11.2/src/game.c:662:10: [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 msg[40]; data/xbubble-0.5.11.2/src/game.c:666: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( msg, _("Stage %d"), game->round ); data/xbubble-0.5.11.2/src/game.c:671: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( msg, _("Round %d"), game->round ); data/xbubble-0.5.11.2/src/game.c:681:10: [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 msg[40]; data/xbubble-0.5.11.2/src/game.c:686: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( msg, _("Stage %d cleared !"), game->round ); data/xbubble-0.5.11.2/src/init.c:90:10: [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 buffer[1024]; data/xbubble-0.5.11.2/src/init.c:126: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 line[128]; data/xbubble-0.5.11.2/src/init.c:127:12: [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. unsigned char r[8]; data/xbubble-0.5.11.2/src/init.c:136: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). fd = fopen( file, "r" ); data/xbubble-0.5.11.2/src/init.c:227:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy( new_fontpath, fontpath, npaths*sizeof(char *)); data/xbubble-0.5.11.2/src/init.c:237: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 name[128]; data/xbubble-0.5.11.2/src/init.c:324: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 line[128]; data/xbubble-0.5.11.2/src/init.c:325: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 framename[128]; data/xbubble-0.5.11.2/src/init.c:329: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). fd = fopen( data_file(filename,1), "r" ); data/xbubble-0.5.11.2/src/init.c:753: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 line[128]; data/xbubble-0.5.11.2/src/init.c:764: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). fd = fopen( data_file(config_file,1), "r" ); data/xbubble-0.5.11.2/src/loadpng.c:45:12: [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. unsigned char header[8]; data/xbubble-0.5.11.2/src/loadpng.c:53: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). fd = fopen( file, "rb" ); data/xbubble-0.5.11.2/src/opponent.c:568:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy( op->array->cell, ca->cell, sizeof(void *)*NB_CELLS); data/xbubble-0.5.11.2/src/rectangle.c:140:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy( &rl->element[rl->size], data/xbubble-0.5.11.2/src/rgba.c:86:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(ri2->data, ri->data, 4*ri->width*ri->height); data/xbubble-0.5.11.2/src/rgba.c:199:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy( ri2->data + row*new_bytes_per_line, data/xbubble-0.5.11.2/src/screens.c:127: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 stats[3][4][32] = { { "","","","" }, { "","","","" }, data/xbubble-0.5.11.2/src/screens.c:148: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( pstats[i][1], "%d", games[j] ); data/xbubble-0.5.11.2/src/screens.c:149: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( pstats[i][2], "%d", rounds[j] ); data/xbubble-0.5.11.2/src/screens.c:150: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( pstats[i][3], "%d", percentage[j] ); data/xbubble-0.5.11.2/src/utils.c:137:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy( dest->element, source->element, sizeof(void *) * dest->size ); data/xbubble-0.5.11.2/src/utils.c:209: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 *name_color[NB_COLORS] = \ data/xbubble-0.5.11.2/src/utils.c:218: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 *name_state[NB_BUBBLE_STATES] = \ data/xbubble-0.5.11.2/src/xbubble.c:251: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 app_name[256]; data/xbubble-0.5.11.2/src/dialog.c:47:47: [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). entry_width = XTextWidth( xfont, line[i], strlen(line[i])); data/xbubble-0.5.11.2/src/dialog.c:81:45: [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). msg_width = XTextWidth( xfont, line[i], strlen(line[i])); data/xbubble-0.5.11.2/src/dialog.c:86:13: [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). line[i], strlen(line[i]) ); data/xbubble-0.5.11.2/src/dialog.c:108: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). msg_width = XTextWidth( xfont, msg, strlen(msg)); data/xbubble-0.5.11.2/src/dialog.c:122:14: [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). msg, strlen(msg) ); data/xbubble-0.5.11.2/src/dialog.c:143:64: [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). tx = (entry+0.5)*win_width/nb - XTextWidth( menu_font,line,strlen(line))/2; data/xbubble-0.5.11.2/src/dialog.c:147:53: [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). tx = ( win_width - XTextWidth( menu_font, line, strlen(line)) )/2; data/xbubble-0.5.11.2/src/dialog.c:150:53: [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). XDrawString( display, menu_win, gc, tx, ty, line, strlen(line) ); data/xbubble-0.5.11.2/src/init.c:103:14: [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). offset = strlen(abs_data_dir); data/xbubble-0.5.11.2/src/init.c:106:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( buffer, abs_data_dir, offset ); data/xbubble-0.5.11.2/src/init.c:112:15: [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). theme_len=strlen(theme); data/xbubble-0.5.11.2/src/init.c:113:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy( buffer + offset, "themes/", 126); data/xbubble-0.5.11.2/src/init.c:114:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( buffer + offset + 7, theme, 119); data/xbubble-0.5.11.2/src/init.c:115:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant character. strncpy( buffer + offset + theme_len + 7, "/", 119 - theme_len); data/xbubble-0.5.11.2/src/init.c:116:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( buffer + offset + theme_len + 8, file, 118 - theme_len); data/xbubble-0.5.11.2/src/init.c:118:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( buffer + offset, file, 126); data/xbubble-0.5.11.2/src/init.c:222: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 ( strncmp( path, fontpath[i], strlen(path) ) == 0 ) { data/xbubble-0.5.11.2/src/init.c:346:7: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. if ( sscanf( line, "%127s%d%d%d", framename, &cx, &cy, &delay) == 4 ) { data/xbubble-0.5.11.2/src/init.c:437:29: [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). copy = copy_orig = calloc(strlen(name) + 1, sizeof(char)); data/xbubble-0.5.11.2/src/init.c:477:25: [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(strcmp(d->d_name + strlen(d->d_name) - 4,".png")!=0) { data/xbubble-0.5.11.2/src/init.c:768: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). copy = copy_orig = calloc(strlen(line) + 1, sizeof(char)); data/xbubble-0.5.11.2/src/init.c:770:12: [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). copy[strlen(line)-1]=' '; ANALYSIS SUMMARY: Hits = 63 Lines analyzed = 7320 in approximately 0.23 seconds (31654 lines/second) Physical Source Lines of Code (SLOC) = 5581 Hits@level = [0] 83 [1] 22 [2] 30 [3] 3 [4] 8 [5] 0 Hits@level+ = [0+] 146 [1+] 63 [2+] 41 [3+] 11 [4+] 8 [5+] 0 Hits/KSLOC@level+ = [0+] 26.1602 [1+] 11.2883 [2+] 7.34635 [3+] 1.97097 [4+] 1.43343 [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.