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/xgammon-0.99.1128/lib/db.c Examining data/xgammon-0.99.1128/src/decision.c Examining data/xgammon-0.99.1128/src/diawin.c Examining data/xgammon-0.99.1128/src/edit.c Examining data/xgammon-0.99.1128/src/filemenu.c Examining data/xgammon-0.99.1128/src/icon.h Examining data/xgammon-0.99.1128/src/misc.c Examining data/xgammon-0.99.1128/src/popup.c Examining data/xgammon-0.99.1128/src/rollout.c Examining data/xgammon-0.99.1128/src/save.c Examining data/xgammon-0.99.1128/src/xgammon.c Examining data/xgammon-0.99.1128/src/allow.c Examining data/xgammon-0.99.1128/src/drawing.c Examining data/xgammon-0.99.1128/src/gammon.h Examining data/xgammon-0.99.1128/src/xgammon.h FINAL RESULTS: data/xgammon-0.99.1128/src/diawin.c:230: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 (s, TournamentText + lt); data/xgammon-0.99.1128/src/filemenu.c:94: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 (str, cwd); data/xgammon-0.99.1128/src/filemenu.c:98:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (str, "%s/%s", cwd, dir); data/xgammon-0.99.1128/src/filemenu.c:101: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(cwd, str); data/xgammon-0.99.1128/src/filemenu.c:119:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (pathname, "%s/%s", cwd, entry->d_name); data/xgammon-0.99.1128/src/filemenu.c:121: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 (pathname, entry->d_name); data/xgammon-0.99.1128/src/filemenu.c:194:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path_and_filename,"%s/%s", cwd, filename); data/xgammon-0.99.1128/src/filemenu.c:224: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 (file_listDir, dir); data/xgammon-0.99.1128/src/misc.c:117:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (add_text, "%s rolls %d and %d.\n", Player[turn-1].name, abs (roll[0]), abs (roll[1])); data/xgammon-0.99.1128/src/misc.c:247:70: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. if (Player[0].type == HUMAN && Player[1].type == HUMAN) sprintf (add_text,"Starting a new game with %s, ", Player[0].name); data/xgammon-0.99.1128/src/misc.c:249:38: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. else if (Player[0].type == HUMAN) sprintf (add_text,"Starting a new game with %s\n", Player[0].name); data/xgammon-0.99.1128/src/misc.c:250:15: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. else sprintf (add_text,"Starting a new game with %s\n", Player[1].name); data/xgammon-0.99.1128/src/misc.c:288:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (add_text, "%s rolled %d, %s rolled %d\n", Player[0].name, abs (roll[0]), Player[1].name, abs (roll[1])); data/xgammon-0.99.1128/src/misc.c:290:20: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. if (roll[0] < 0) sprintf (add_text, "%s makes the first move.\n", Player[1].name); data/xgammon-0.99.1128/src/misc.c:291:10: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. else sprintf (add_text, "%s makes the first move.\n\n", Player[0].name); data/xgammon-0.99.1128/src/misc.c:309:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (add_text, "%s can't move.\n\n", Player[turn-1].name); data/xgammon-0.99.1128/src/misc.c:311:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (add_text, "%s moves ", Player[turn-1].name); data/xgammon-0.99.1128/src/misc.c:316:11: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat (add_text, f); data/xgammon-0.99.1128/src/misc.c:320:11: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat (add_text, t); data/xgammon-0.99.1128/src/misc.c:422:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (add_text, "%s wins the %d. game %s and gets %d points.\n", Player[whom-1].name, tournament.game_number, gammon_str, doubler.value); data/xgammon-0.99.1128/src/misc.c:424:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (add_text, "%s wins the game %s and gets %d points.\n", Player[whom-1].name, gammon_str, doubler.value); data/xgammon-0.99.1128/src/misc.c:427:38: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. if (gammon_resource.moneygame) sprintf (add_text, "score in moneygame match: %s-%d %s-%d\n\n", Player[0].name, Player[0].points, Player[1].name, Player[1].points); data/xgammon-0.99.1128/src/misc.c:428:38: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. else if (gammon_resource.winat) sprintf (add_text, "score in %d point match: %s-%d %s-%d\n\n", tournament.winning_point, Player[0].name, Player[0].points, Player[1].name, Player[1].points); data/xgammon-0.99.1128/src/misc.c:434:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (add_text, "%s wins the %d point match %d-%d .\n\n", Player[whom-1].name, tournament.winning_point, Player[0].points, Player[1].points); data/xgammon-0.99.1128/src/popup.c:169:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (add_text, "%s doubles.\n", Player[turn-1].name); data/xgammon-0.99.1128/src/popup.c:199:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (add_text, "%s accepts the double.\n\n", Player[other-1].name); data/xgammon-0.99.1128/src/popup.c:201:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (add_text, "%s gives up.\n\n", Player[other-1].name); data/xgammon-0.99.1128/src/popup.c:229:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (add_text,"%s doubles.\n", Player[turn-1].name); data/xgammon-0.99.1128/src/popup.c:274:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (add_text, "%s gives up. %s wins %d point\n\n", Player[other-1].name, Player[turn-1].name, doubler.value); data/xgammon-0.99.1128/src/popup.c:283:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (add_text,"%s accepts the double.\n\n", Player[other-1].name); data/xgammon-0.99.1128/src/rollout.c:128:2: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (result_file, add_text); data/xgammon-0.99.1128/src/rollout.c:132:2: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (result_file, add_text); data/xgammon-0.99.1128/src/rollout.c:136:2: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (result_file, add_text); data/xgammon-0.99.1128/src/rollout.c:140:2: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (result_file, add_text); data/xgammon-0.99.1128/src/rollout.c:144:2: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (result_file, add_text); data/xgammon-0.99.1128/src/rollout.c:309:3: [4] (shell) execvp: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execvp ("xgammon", argv); data/xgammon-0.99.1128/src/xgammon.c:462:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (add_text, "%s can't move.\n\n", Player[turn-1].name); data/xgammon-0.99.1128/src/xgammon.c:623:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (add_text, "%s gives up. %s wins %d point\n\n", Player[other-1].name, Player[turn-1].name, doubler.value); data/xgammon-0.99.1128/src/xgammon.c:628:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (add_text,"%s accepts the double.\n\n", Player[other-1].name); data/xgammon-0.99.1128/src/xgammon.c:833:4: [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[0].name, UserName()); data/xgammon-0.99.1128/src/xgammon.c:842:4: [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[1].name, UserName()); data/xgammon-0.99.1128/src/xgammon.c:859: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[0].name, UserName()); data/xgammon-0.99.1128/src/xgammon.c:881:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (add_text, "%s and %s start a %s match.\n", Player[0].name, Player[1].name, s); data/xgammon-0.99.1128/src/xgammon.c:888:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (add_text, "%s and %s start a %d %s match.\n", Player[0].name, Player[1].name, tournament.winning_point, s); data/xgammon-0.99.1128/src/xgammon.c:1078: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 (name, XtName (w)); data/xgammon-0.99.1128/src/xgammon.c:1422:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (add_text, "%s wants to resign\n", Player[turn-1].name); data/xgammon-0.99.1128/src/xgammon.c:309:2: [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 (time (NULL)); /* rolling */ data/xgammon-0.99.1128/lib/db.c:264: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). fid = fopen("xgammon.db", "w+b"); data/xgammon-0.99.1128/src/allow.c:238:15: [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). fid = fopen("maxpos.xgammon", "a"); data/xgammon-0.99.1128/src/diawin.c:62: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 add_text[LINESIZ]; /* global text buffer for strings from somewhere to add */ data/xgammon-0.99.1128/src/diawin.c:63: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 DialogText[DIALOGSIZE]; /* text buffer for widget */ data/xgammon-0.99.1128/src/diawin.c:64: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 TournamentText[DIALOGSIZE]; /* text buffer for widget */ data/xgammon-0.99.1128/src/diawin.c:228:2: [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 s[LINESIZ]; data/xgammon-0.99.1128/src/drawing.c:377:2: [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 t[3]; data/xgammon-0.99.1128/src/drawing.c:416: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 (t, "%d", how_double); /* see 6 lines below */ data/xgammon-0.99.1128/src/edit.c:118:2: [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 value[15]; data/xgammon-0.99.1128/src/edit.c:146:21: [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 (turn == BLACK) strcpy (value,"black"); data/xgammon-0.99.1128/src/edit.c:147:8: [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. else strcpy (value,"white"); data/xgammon-0.99.1128/src/edit.c:158: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 (value, "%d", doubler.value); data/xgammon-0.99.1128/src/edit.c:163:22: [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 (!doubler.owner) strcpy (value,"none"); data/xgammon-0.99.1128/src/edit.c:164:36: [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. else if (doubler.owner == BLACK) strcpy (value,"black"); data/xgammon-0.99.1128/src/edit.c:165:8: [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. else strcpy (value,"white"); data/xgammon-0.99.1128/src/edit.c:179: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 (value, "%d", roll[0]); data/xgammon-0.99.1128/src/edit.c:184: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 (value, "%d", roll[1]); data/xgammon-0.99.1128/src/edit.c:207: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 (value, "%d", doubler.value); data/xgammon-0.99.1128/src/edit.c:213:6: [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 (value, "black"); data/xgammon-0.99.1128/src/edit.c:217:6: [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 (value, "white"); data/xgammon-0.99.1128/src/edit.c:221:6: [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 (value, "none"); data/xgammon-0.99.1128/src/edit.c:230:6: [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 (value, "ignore roll "); data/xgammon-0.99.1128/src/edit.c:234:6: [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 (value, "dice: "); data/xgammon-0.99.1128/src/edit.c:242: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 (value, "%d", roll[0]); data/xgammon-0.99.1128/src/edit.c:249: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 (value, "%d", roll[1]); data/xgammon-0.99.1128/src/filemenu.c:53: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 cwd[MAXPATHLEN]; /* current working directory */ data/xgammon-0.99.1128/src/filemenu.c: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. static char file_listDir[MAXPATHLEN]; /* current directory of file list */ data/xgammon-0.99.1128/src/filemenu.c:82: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 str[512]; data/xgammon-0.99.1128/src/filemenu.c:112: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 pathname[512]; data/xgammon-0.99.1128/src/filemenu.c:160:38: [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. for (i=0; filelist[i]; i++) XtFree((char *)filelist[i]); data/xgammon-0.99.1128/src/filemenu.c:167:15: [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. XtFree((char *)name[j]); data/xgammon-0.99.1128/src/filemenu.c:182: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, path_and_filename[MAXPATHLEN]; data/xgammon-0.99.1128/src/filemenu.c:193:2: [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 *v[2], *flag = "m"; data/xgammon-0.99.1128/src/filemenu.c:306:2: [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 *v[2], *flag = "m"; data/xgammon-0.99.1128/src/gammon.h:110:2: [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[25]; data/xgammon-0.99.1128/src/misc.c:41: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 protokol_file_name[50]; data/xgammon-0.99.1128/src/misc.c:248:70: [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 (Player[0].type == COMPUTER && Player[1].type == COMPUTER) sprintf (add_text,"Starting a new game with xgammon (0)\n"); data/xgammon-0.99.1128/src/misc.c:305:2: [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 f[5], t[5]; data/xgammon-0.99.1128/src/misc.c:314:28: [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 ((m+i)->from != BAR) sprintf (f,"%d-", (m+i)->from); data/xgammon-0.99.1128/src/misc.c:315:9: [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. else strcpy (f,"bar-"); data/xgammon-0.99.1128/src/misc.c:318:30: [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 ((m+i)->to != end_pin) sprintf (t,"%d ", (m+i)->to); data/xgammon-0.99.1128/src/misc.c:319:9: [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. else strcpy (t,"off "); data/xgammon-0.99.1128/src/misc.c:322:3: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat (add_text, ".\n\n"); data/xgammon-0.99.1128/src/misc.c:626:17: [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). maildumpfile = fopen ("xgammon.maildump", "w"); data/xgammon-0.99.1128/src/misc.c:729: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 (protokol_file_name,"xgammon.protokol.%d", getpid ()); data/xgammon-0.99.1128/src/misc.c:730:19: [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). protokol_file = fopen (protokol_file_name, "w"); data/xgammon-0.99.1128/src/popup.c:63:2: [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 *menu1_names[10]; data/xgammon-0.99.1128/src/popup.c:64:2: [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 *menu2_names[10]; data/xgammon-0.99.1128/src/popup.c:65:2: [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 *menu3_names[10]; data/xgammon-0.99.1128/src/popup.c:219:2: [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 label_string[128]; data/xgammon-0.99.1128/src/popup.c:245:22: [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 (turn == BLACK) strcpy (label_string, " white player: \n do you accept doubling? "); data/xgammon-0.99.1128/src/popup.c:246:12: [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. else strcpy (label_string, " black player: \n do you accept doubling? "); data/xgammon-0.99.1128/src/popup.c:248:3: [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 (label_string, " I'd like to double \n do you accept? "); data/xgammon-0.99.1128/src/rollout.c:54:2: [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 *v[2], *flag = "m"; data/xgammon-0.99.1128/src/rollout.c:78: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 (add_text, "rollout: %d games\n", gammon_resource.num_rollouts); data/xgammon-0.99.1128/src/rollout.c:117: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 (add_text, "done.. won games: black %d, white %d points: black %d, white %d\n",won_games[BLACK], won_games[WHITE], Player[0].points, Player[1].points); data/xgammon-0.99.1128/src/rollout.c:120: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). result_file = fopen (gammon_resource.position_file, "a"); data/xgammon-0.99.1128/src/rollout.c:124: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 (add_text, "of %d games\n", tournament.winning_point); data/xgammon-0.99.1128/src/rollout.c:127: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 (add_text, " black won %d games and got %d points.\n", won_games[BLACK], Player[0].points); data/xgammon-0.99.1128/src/rollout.c:131: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 (add_text, " white won %d games and got %d points.\n", won_games[WHITE], Player[1].points); data/xgammon-0.99.1128/src/rollout.c:135: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 (add_text, " backgammons: black: %d white %d\n", Player[BLACK].backgammons, Player[WHITE].backgammons); data/xgammon-0.99.1128/src/rollout.c:139: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 (add_text, " gammons: black: %d white %d\n", Player[BLACK].gammons, Player[WHITE].gammons); data/xgammon-0.99.1128/src/rollout.c:143: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 (add_text, " in percent: black won %2.2f%%, white won %2.2f%%\n\n\n", ((float) won_games[BLACK] * 100 / (float) tournament.winning_point), ((float) won_games[WHITE] * 100 / (float) tournament.winning_point)); data/xgammon-0.99.1128/src/rollout.c:235: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(add_text,"rollout game number %d\n", tournament.game_number); data/xgammon-0.99.1128/src/rollout.c:279:2: [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 *argv[8]; data/xgammon-0.99.1128/src/rollout.c:280:2: [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 *v[3]; data/xgammon-0.99.1128/src/rollout.c:281:2: [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 rollout_save_file[50]; data/xgammon-0.99.1128/src/rollout.c:282:2: [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 nr[7]; data/xgammon-0.99.1128/src/rollout.c:284: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 (nr, "%d", gammon_resource.num_rollouts); data/xgammon-0.99.1128/src/rollout.c:286: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 (rollout_save_file, "xgammon.rollout.%d.save", (ppid + called_rollout++)); data/xgammon-0.99.1128/src/save.c:68:14: [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). save_file = fopen (filename, "w"); data/xgammon-0.99.1128/src/save.c:113:14: [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). save_file = fopen ("xgammon.sig_save", "w"); data/xgammon-0.99.1128/src/save.c:159: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). if (!(f = fopen ("xgammon.config", "w"))) { data/xgammon-0.99.1128/src/xgammon.c:313:21: [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). endgame_database = fopen (gammon_resource.database, "rb"); data/xgammon-0.99.1128/src/xgammon.c:834:4: [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 (Player[1].name, "xgammon"); data/xgammon-0.99.1128/src/xgammon.c:841:4: [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 (Player[0].name, "xgammon"); data/xgammon-0.99.1128/src/xgammon.c:850:3: [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 (Player[0].name, "black"); data/xgammon-0.99.1128/src/xgammon.c:851:3: [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 (Player[1].name, "white"); data/xgammon-0.99.1128/src/xgammon.c:860:3: [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 (Player[1].name, "other"); data/xgammon-0.99.1128/src/xgammon.c:1075:2: [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[64]; data/xgammon-0.99.1128/src/xgammon.c:1376: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 (add_text, " picount:\n black: %d, white: %d ", abs ((int) pip_count[BLACK]), abs ((int) pip_count[WHITE])); data/xgammon-0.99.1128/src/diawin.c:148: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). textblock.length = strlen(s); data/xgammon-0.99.1128/src/diawin.c:191: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). textblock.length = strlen(s); data/xgammon-0.99.1128/src/drawing.c:441:16: [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). font_width *= strlen (t); /* see 7 lines above */ data/xgammon-0.99.1128/src/drawing.c:446:51: [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). XDrawImageString (dpy, window, diceGC, x , y, t, strlen (t)); data/xgammon-0.99.1128/src/drawing.c:447:51: [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). XDrawImageString (dpy, pixmap, diceGC, x , y, t, strlen (t)); data/xgammon-0.99.1128/src/drawing.c:449:57: [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). XDrawImageString (o_dpy, o_window, o_diceGC, x , y, t, strlen (t)); data/xgammon-0.99.1128/src/drawing.c:450:57: [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). XDrawImageString (o_dpy, o_pixmap, o_diceGC, x , y, t, strlen (t)); data/xgammon-0.99.1128/src/filemenu.c:89:16: [1] (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 character. if( j == 1 ) strcpy (str, "/"); data/xgammon-0.99.1128/src/filemenu.c:99:6: [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). str[strlen (str) - 1]='\0'; data/xgammon-0.99.1128/src/filemenu.c:125:2: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(entry->d_name, "/"); data/xgammon-0.99.1128/src/filemenu.c:129:37: [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(entry->d_name + strlen(entry->d_name) - sizeof(".dvi") + 1, ".dvi") == 0) return False; data/xgammon-0.99.1128/src/filemenu.c:130:37: [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 (strcmp(entry->d_name + strlen(entry->d_name) - sizeof(".c") + 1, ".c") == 0) return False; data/xgammon-0.99.1128/src/filemenu.c:131:37: [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 (strcmp(entry->d_name + strlen(entry->d_name) - sizeof(".o") + 1, ".o") == 0) return False; data/xgammon-0.99.1128/src/filemenu.c:132:37: [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 (strcmp(entry->d_name + strlen(entry->d_name) - sizeof(".h") + 1, ".h") == 0) return False; data/xgammon-0.99.1128/src/filemenu.c:187: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 (filename[ strlen (filename) - 1] == '/') { data/xgammon-0.99.1128/src/filemenu.c:313: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). if (!strlen (v[1])) return; data/xgammon-0.99.1128/src/misc.c:45:9: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. #define usleep (a) sleep ((a/10)) data/xgammon-0.99.1128/src/misc.c:331:3: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep (delaytime); data/xgammon-0.99.1128/src/xgammon.c:143:6: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. void usleep (unsigned long delay) { data/xgammon-0.99.1128/src/xgammon.c:149:9: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. #define usleep(a) sleep((a/10)) data/xgammon-0.99.1128/src/xgammon.c:600:34: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. if (!gammon_resource.watchmove) usleep (delaytime); data/xgammon-0.99.1128/src/xgammon.c:696:34: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. if (!gammon_resource.watchmove) usleep (delaytime); ANALYSIS SUMMARY: Hits = 150 Lines analyzed = 6709 in approximately 0.23 seconds (29537 lines/second) Physical Source Lines of Code (SLOC) = 5010 Hits@level = [0] 140 [1] 22 [2] 81 [3] 1 [4] 46 [5] 0 Hits@level+ = [0+] 290 [1+] 150 [2+] 128 [3+] 47 [4+] 46 [5+] 0 Hits/KSLOC@level+ = [0+] 57.8842 [1+] 29.9401 [2+] 25.5489 [3+] 9.38124 [4+] 9.18164 [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.