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/sudoku-1.0.5/sudoku.c
Examining data/sudoku-1.0.5/win32/curses.c
Examining data/sudoku-1.0.5/win32/curses.h
Examining data/sudoku-1.0.5/win32/termios.c
Examining data/sudoku-1.0.5/win32/termios.h
Examining data/sudoku-1.0.5/win32/unistd.c
Examining data/sudoku-1.0.5/win32/unistd.h

FINAL RESULTS:

data/sudoku-1.0.5/sudoku.c:544:17:  [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(f, fStandard == opt_format ? " ." : ".");
data/sudoku-1.0.5/sudoku.c:546:17:  [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(f, fStandard == opt_format ? "%2d" : "%d",
data/sudoku-1.0.5/sudoku.c:755:17:  [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(f, 0 == j % 6 ? "\n" : ", ");
data/sudoku-1.0.5/sudoku.c:2192:13:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
            sprintf(title, "randomly generated - %s", generated_class);
data/sudoku-1.0.5/sudoku.c:2204:5:  [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(title, classify());
data/sudoku-1.0.5/sudoku.c:3095:17:  [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(temp_str + 1, default_name);
data/sudoku-1.0.5/sudoku.c:3113:13:  [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 (buffer, temp_str);
data/sudoku-1.0.5/sudoku.c:3173:17:  [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(wbp + 1, dn);
data/sudoku-1.0.5/sudoku.c:3186:21:  [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(wbp, dn);
data/sudoku-1.0.5/sudoku.c:3276:21:  [4] (shell) popen:
  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.
                f = popen(p, "w");
data/sudoku-1.0.5/sudoku.c:3390:13:  [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(title, nt);
data/sudoku-1.0.5/sudoku.c:3628:17:  [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(userfile, arg);  /* Save the filename */
data/sudoku-1.0.5/win32/unistd.h:16:9:  [4] (shell) popen:
  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.
#define popen  _popen
data/sudoku-1.0.5/sudoku.c:4018:5:  [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 int)(time(0) ^ getpid()));
data/sudoku-1.0.5/sudoku.c:114: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 dtct[4] = {
data/sudoku-1.0.5/sudoku.c:385:18:  [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).
        stream = fopen(filename, "r");
data/sudoku-1.0.5/sudoku.c:500: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).
    FILE *  f   = fopen(template_path, "r");
data/sudoku-1.0.5/sudoku.c:502:13:  [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).
        f = fopen(template_path, "w");
data/sudoku-1.0.5/sudoku.c:1556: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 line[80];
data/sudoku-1.0.5/sudoku.c:1557: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 title[80];
data/sudoku-1.0.5/sudoku.c:1593: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.
        strcpy(title, "(untitled)");
data/sudoku-1.0.5/sudoku.c:1693: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 statusline[LINE_SIZE];  /* Buffer for status line */
data/sudoku-1.0.5/sudoku.c:2203: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(title, "randomly generated - ");
data/sudoku-1.0.5/sudoku.c:2223: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).
    precanned = fopen(filename, "r");
data/sudoku-1.0.5/sudoku.c:2377: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 userfile[PATH_MAX];
data/sudoku-1.0.5/sudoku.c:2378: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 templatefile[PATH_MAX];
data/sudoku-1.0.5/sudoku.c:3069:9:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
        char abort_message[LINE_SIZE - LEFT_MIDDLE + 1];
data/sudoku-1.0.5/sudoku.c:3286:29:  [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).
                        f = fopen(p, "a");
data/sudoku-1.0.5/sudoku.c:3289:29:  [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).
                        f = fopen(p, "w");
data/sudoku-1.0.5/sudoku.c:3356:22:  [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).
            opened = fopen(p, "r");
data/sudoku-1.0.5/sudoku.c:3377: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 new_title[80];
data/sudoku-1.0.5/sudoku.c:3600:13:  [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(statusline, "%d @ row %d, column %d",
data/sudoku-1.0.5/sudoku.c:3605:13:  [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(statusline, "(try the digit %d)",
data/sudoku-1.0.5/sudoku.c:3698:48:  [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).
                                num_generate = atoi(arg + 1);
data/sudoku-1.0.5/sudoku.c:3704:48:  [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).
                                num_generate = atoi(*++argv);
data/sudoku-1.0.5/sudoku.c:3972:17:  [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(statusline, "Well done"
data/sudoku-1.0.5/sudoku.c:1756: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).
                 (int)((LINE_SIZE - strlen(title)) / 2),
data/sudoku-1.0.5/sudoku.c:1803: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).
             (int)((LINE_SIZE - strlen(txt)) / 2),
data/sudoku-1.0.5/sudoku.c:1828:5:  [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(2000000);
data/sudoku-1.0.5/sudoku.c:2420: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).
    ep->ecn         = (int)(strlen(edit_buffer));
data/sudoku-1.0.5/sudoku.c:3074:9:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
        strncpy(abort_message, first_part, storage_size);
data/sudoku-1.0.5/sudoku.c:3076: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).
        storage_size -= strlen(abort_message) + 1;
data/sudoku-1.0.5/sudoku.c:3077:9:  [1] (buffer) strncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf,
  or automatically resizing strings.
        strncat (abort_message, operation_name, storage_size);
data/sudoku-1.0.5/sudoku.c:3078:48:  [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).
        storage_size = sizeof(abort_message) - strlen(abort_message) - 1;
data/sudoku-1.0.5/sudoku.c:3079:9:  [1] (buffer) strncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf,
  or automatically resizing strings.
        strncat (abort_message, last_part, storage_size);
data/sudoku-1.0.5/sudoku.c:3081:9:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
        strncpy (temp_str, buffer, buffsize);
data/sudoku-1.0.5/sudoku.c:3092:52:  [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).
            size_t dns = ((default_name != NULL) ? strlen(default_name) : 0);
data/sudoku-1.0.5/sudoku.c:3169: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).
            assert(dn != NULL && strlen(dn) < 6 + 3);
data/sudoku-1.0.5/sudoku.c:3181: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 (strlen(wbp) + strlen(dn) > wbs) {
data/sudoku-1.0.5/sudoku.c:3181: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 (strlen(wbp) + strlen(dn) > wbs) {
data/sudoku-1.0.5/sudoku.c:3184:25:  [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(wbp, "/");
data/sudoku-1.0.5/win32/curses.c:88:35:  [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).
        size_t      str_size    = strlen(str);
data/sudoku-1.0.5/win32/curses.c:109: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).
    WriteConsole(_conout, str, (DWORD)strlen(str), &wrote, 0);
data/sudoku-1.0.5/win32/unistd.h:17: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 / 1000)

ANALYSIS SUMMARY:

Hits = 54
Lines analyzed = 4442 in approximately 0.15 seconds (29864 lines/second)
Physical Source Lines of Code (SLOC) = 3483
Hits@level = [0]  49 [1]  18 [2]  22 [3]   1 [4]  13 [5]   0
Hits@level+ = [0+] 103 [1+]  54 [2+]  36 [3+]  14 [4+]  13 [5+]   0
Hits/KSLOC@level+ = [0+] 29.5722 [1+] 15.5039 [2+] 10.3359 [3+] 4.01952 [4+] 3.73241 [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.