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/glktermw-1.0.4+git20200122/gtschan.c
Examining data/glktermw-1.0.4+git20200122/gtgestal.c
Examining data/glktermw-1.0.4+git20200122/gtinput.c
Examining data/glktermw-1.0.4+git20200122/gtmessin.c
Examining data/glktermw-1.0.4+git20200122/gi_blorb.c
Examining data/glktermw-1.0.4+git20200122/gtw_blnk.h
Examining data/glktermw-1.0.4+git20200122/gtoption.h
Examining data/glktermw-1.0.4+git20200122/gtw_pair.c
Examining data/glktermw-1.0.4+git20200122/gtmisc.c
Examining data/glktermw-1.0.4+git20200122/gi_dispa.h
Examining data/glktermw-1.0.4+git20200122/cgdate.c
Examining data/glktermw-1.0.4+git20200122/glkstart.h
Examining data/glktermw-1.0.4+git20200122/gtw_buf.h
Examining data/glktermw-1.0.4+git20200122/gtwindow.c
Examining data/glktermw-1.0.4+git20200122/gtfref.c
Examining data/glktermw-1.0.4+git20200122/gtw_grid.h
Examining data/glktermw-1.0.4+git20200122/gtw_pair.h
Examining data/glktermw-1.0.4+git20200122/gtmessag.c
Examining data/glktermw-1.0.4+git20200122/gi_blorb.h
Examining data/glktermw-1.0.4+git20200122/gtw_blnk.c
Examining data/glktermw-1.0.4+git20200122/glkterm.h
Examining data/glktermw-1.0.4+git20200122/gtstyle.c
Examining data/glktermw-1.0.4+git20200122/gtw_grid.c
Examining data/glktermw-1.0.4+git20200122/cgunicod.c
Examining data/glktermw-1.0.4+git20200122/gtblorb.c
Examining data/glktermw-1.0.4+git20200122/main.c
Examining data/glktermw-1.0.4+git20200122/gtevent.c
Examining data/glktermw-1.0.4+git20200122/cgunigen.c
Examining data/glktermw-1.0.4+git20200122/glk.h
Examining data/glktermw-1.0.4+git20200122/gtstream.c
Examining data/glktermw-1.0.4+git20200122/gi_dispa.c
Examining data/glktermw-1.0.4+git20200122/gtncursesw.c
Examining data/glktermw-1.0.4+git20200122/glkstart.c
Examining data/glktermw-1.0.4+git20200122/gtw_buf.c

FINAL RESULTS:

data/glktermw-1.0.4+git20200122/gtfref.c:83: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(fref->filename, filename);
data/glktermw-1.0.4+git20200122/gtfref.c:233:5:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
    sprintf(buf2, "%s/%s%s", workingdir, buf, suffix);
data/glktermw-1.0.4+git20200122/gtfref.c:283:5:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
    sprintf(newbuf, "%s %s: ", prompt, prompt2);
data/glktermw-1.0.4+git20200122/gtfref.c:344:9:  [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(newbuf, cx);
data/glktermw-1.0.4+git20200122/gtfref.c:346:9:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
        sprintf(newbuf, "%s/%s", workingdir, cx);
data/glktermw-1.0.4+git20200122/gtfref.c:360:9:  [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(newbuf, suffix);
data/glktermw-1.0.4+git20200122/gtfref.c:365:13:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
            sprintf(buf2, "Overwrite \"%s\"? [y/n] ", cx);
data/glktermw-1.0.4+git20200122/gtfref.c:387: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(lastbuf, cx);
data/glktermw-1.0.4+git20200122/gtfref.c:482: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(lastsavename, filename+ix);
data/glktermw-1.0.4+git20200122/gtfref.c:488: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(lastscriptname, lastsavename);
data/glktermw-1.0.4+git20200122/gtfref.c:489: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(lastdataname, lastsavename);
data/glktermw-1.0.4+git20200122/gtfref.c:491: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(lastsavename, gli_suffix_for_usage(fileusage_SavedGame));
data/glktermw-1.0.4+git20200122/gtfref.c:492: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(lastscriptname, gli_suffix_for_usage(fileusage_Transcript));
data/glktermw-1.0.4+git20200122/gtfref.c:493: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(lastdataname, gli_suffix_for_usage(fileusage_Data));
data/glktermw-1.0.4+git20200122/gtmessag.c:62:5:  [4] (buffer) wcscpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using a function version that stops copying at the end
  of the buffer.
    wcscpy(msgbuf, msg);
data/glktermw-1.0.4+git20200122/gtfref.c:163:16:  [3] (tmpfile) tmpnam:
  Temporary file race condition (CWE-377).
    filename = tmpnam(NULL);
data/glktermw-1.0.4+git20200122/gtwindow.c:146:13:  [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.
    newterm(getenv("TERM"), stdout, stdin);
data/glktermw-1.0.4+git20200122/cgunicod.c:248:17:  [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(newoutbuf, buf, outcount * sizeof(glui32));
data/glktermw-1.0.4+git20200122/cgunicod.c:264:13:  [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(buf, newoutbuf, finallen * sizeof(glui32));
data/glktermw-1.0.4+git20200122/cgunicod.c:496:9:  [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(buf, dest, newlen * sizeof(glui32));
data/glktermw-1.0.4+git20200122/cgunicod.c:518:9:  [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(buf, dest, newlen * sizeof(glui32));
data/glktermw-1.0.4+git20200122/gi_blorb.c:100: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 buffer[16];
data/glktermw-1.0.4+git20200122/glkterm.h:173:17:  [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 unsigned char char_printable_table[256];
data/glktermw-1.0.4+git20200122/glkterm.h:174:17:  [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 unsigned char char_typable_table[256];
data/glktermw-1.0.4+git20200122/glkterm.h:176:17:  [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 unsigned char char_from_native_table[256];
data/glktermw-1.0.4+git20200122/glkterm.h:177:17:  [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 unsigned char char_to_native_table[256];
data/glktermw-1.0.4+git20200122/gtfref.c:27: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 workingdir[BUFLEN] = ".";
data/glktermw-1.0.4+git20200122/gtfref.c:28: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 lastsavename[BUFLEN] = "game.glksave";
data/glktermw-1.0.4+git20200122/gtfref.c:29: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 lastscriptname[BUFLEN] = "script.txt";
data/glktermw-1.0.4+git20200122/gtfref.c:30: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 lastcmdname[BUFLEN] = "commands.txt";
data/glktermw-1.0.4+git20200122/gtfref.c:31: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 lastdataname[BUFLEN] = "file.glkdata";
data/glktermw-1.0.4+git20200122/gtfref.c:197: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 buf[BUFLEN];
data/glktermw-1.0.4+git20200122/gtfref.c:198: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 buf2[2*BUFLEN+10];
data/glktermw-1.0.4+git20200122/gtfref.c:228: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(buf, "null");
data/glktermw-1.0.4+git20200122/gtfref.c:249: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 buf[BUFLEN];
data/glktermw-1.0.4+git20200122/gtfref.c:250: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 buf2[BUFLEN+32];
data/glktermw-1.0.4+git20200122/gtfref.c:251: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 newbuf[2*BUFLEN+10];
data/glktermw-1.0.4+git20200122/gtfref.c:252:5:  [2] (buffer) wchar_t:
  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.
    wchar_t prbuf[BUFLEN], wcsbuf[BUFLEN];
data/glktermw-1.0.4+git20200122/gtinput.c:370:12:  [2] (buffer) wchar_t:
  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 wchar_t kbuf[32];
data/glktermw-1.0.4+git20200122/gtinput.c:710:9:  [2] (buffer) wchar_t:
  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.
        wchar_t buf[256];
data/glktermw-1.0.4+git20200122/gtmessag.c:25:5:  [2] (buffer) wchar_t:
  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.
    wchar_t buf[256];
data/glktermw-1.0.4+git20200122/gtmisc.c:14:17:  [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 unsigned char char_tolower_table[256];
data/glktermw-1.0.4+git20200122/gtmisc.c:15:17:  [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 unsigned char char_toupper_table[256];
data/glktermw-1.0.4+git20200122/gtmisc.c:16: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.
unsigned char char_printable_table[256];
data/glktermw-1.0.4+git20200122/gtmisc.c:17: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.
unsigned char char_typable_table[256];
data/glktermw-1.0.4+git20200122/gtstream.c:229: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 modestr[16];
data/glktermw-1.0.4+git20200122/gtstream.c:249: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).
        fl = fopen(fref->filename, "ab");
data/glktermw-1.0.4+git20200122/gtstream.c:266:13:  [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(modestr, "r+");
data/glktermw-1.0.4+git20200122/gtstream.c:271:13:  [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(modestr, "r+");
data/glktermw-1.0.4+git20200122/gtstream.c:278:10:  [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).
    fl = fopen(fref->filename, modestr);
data/glktermw-1.0.4+git20200122/gtstream.c:466: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 modestr[16];
data/glktermw-1.0.4+git20200122/gtstream.c:477:10:  [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).
    fl = fopen(pathname, modestr);
data/glktermw-1.0.4+git20200122/gtstream.c:789:21:  [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(str->bufptr, buf, len);
data/glktermw-1.0.4+git20200122/gtstream.c:840:51:  [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 ch = ((unsigned char *)buf)[lx];
data/glktermw-1.0.4+git20200122/gtstream.c:1173:25:  [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(cbuf, str->bufptr, len);
data/glktermw-1.0.4+git20200122/gtw_buf.c:428:13:  [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(ln->words, dwin->tmpwords, lineeatto * sizeof(tbword_t));
data/glktermw-1.0.4+git20200122/gtw_buf.c:495:9:  [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(&(lines[oldbeg]), dwin->tmplines, newnum * sizeof(tbline_t));
data/glktermw-1.0.4+git20200122/gtw_buf.c:1075:28:  [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.
            cx[ix] = UCS(((char *)buf)[ix]);
data/glktermw-1.0.4+git20200122/gtw_buf.c:1090: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.
            ((char *)buf)[ix] = Lat(val);
data/glktermw-1.0.4+git20200122/gtw_buf.c:1138:9:  [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(cx, &(dwin->chars[dwin->infence]), len * sizeof (wchar_t));
data/glktermw-1.0.4+git20200122/gtw_buf.c:1301:21:  [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(cx, &(dwin->chars[dwin->infence]), len * sizeof(wchar_t));
data/glktermw-1.0.4+git20200122/gtw_grid.c:551:25:  [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 ch = ((char *)buf)[ix];
data/glktermw-1.0.4+git20200122/gtw_grid.c:574: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.
            ((char *)buf)[ix] = Lat(kval);
data/glktermw-1.0.4+git20200122/gtwindow.c:30:8:  [2] (buffer) wchar_t:
  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 wchar_t spacebuffer[NUMSPACES+1];
data/glktermw-1.0.4+git20200122/main.c:88: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).
                && (atoi(cx) != 0 || cx[0] == '0')) {
data/glktermw-1.0.4+git20200122/main.c:118:29:  [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).
                        || (atoi(argv[ix+1]) == 0 && argv[ix+1][0] != '0')) {
data/glktermw-1.0.4+git20200122/main.c:302:19:  [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).
            val = atoi(cx);
data/glktermw-1.0.4+git20200122/gtfref.c:82: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).
    fref->filename = malloc(1 + strlen(filename));
data/glktermw-1.0.4+git20200122/gtfref.c:229: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).
        len = strlen(buf);
data/glktermw-1.0.4+git20200122/gtfref.c:337: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).
    val = strlen(cx);
data/glktermw-1.0.4+git20200122/gtfref.c:349: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).
    val = strlen(newbuf);
data/glktermw-1.0.4+git20200122/gtfref.c:467: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).
    for (ix=strlen(filename)-1; ix >= 0; ix--) 
data/glktermw-1.0.4+git20200122/gtfref.c:473:9:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
        strncpy(workingdir, filename, ix);
data/glktermw-1.0.4+git20200122/gtfref.c:483: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).
    for (ix=strlen(lastsavename)-1; ix >= 0; ix--) 
data/glktermw-1.0.4+git20200122/gtinput.c:451:9:  [1] (buffer) wcsncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, or
  automatically resizing strings. Risk is low because the source is a
  constant string.
        wcsncat(kbuf, L"ctrl-", 32);
data/glktermw-1.0.4+git20200122/gtinput.c:452:13:  [1] (buffer) wcslen:
  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).
        l = wcslen(kbuf);
data/glktermw-1.0.4+git20200122/gtinput.c:713:9:  [1] (buffer) wcsncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, or
  automatically resizing strings. Risk is low because the source is a
  constant string.
        wcsncat(buf, L"The key <", 256);
data/glktermw-1.0.4+git20200122/gtinput.c:714:9:  [1] (buffer) wcsncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, or
  automatically resizing strings.
        wcsncat(buf, key_to_name(key), 256 - wcslen(buf));
data/glktermw-1.0.4+git20200122/gtinput.c:714:46:  [1] (buffer) wcslen:
  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).
        wcsncat(buf, key_to_name(key), 256 - wcslen(buf));
data/glktermw-1.0.4+git20200122/gtinput.c:715:9:  [1] (buffer) wcsncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, or
  automatically resizing strings. Risk is low because the source is a
  constant string.
        wcsncat(buf, L"> is not currently defined.", 256 - wcslen(buf));
data/glktermw-1.0.4+git20200122/gtinput.c:715:60:  [1] (buffer) wcslen:
  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).
        wcsncat(buf, L"> is not currently defined.", 256 - wcslen(buf));
data/glktermw-1.0.4+git20200122/gtmessag.c:32:5:  [1] (buffer) wcsncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, or
  automatically resizing strings. Risk is low because the source is a
  constant string.
    wcsncat(buf, L"Glk library error: ", 256);
data/glktermw-1.0.4+git20200122/gtmessag.c:33:9:  [1] (buffer) wcslen:
  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).
    l = wcslen(buf);
data/glktermw-1.0.4+git20200122/gtmessag.c:34:5:  [1] (buffer) wcsncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, or
  automatically resizing strings.
    wcsncat(buf + l, msg, 256 - l);
data/glktermw-1.0.4+git20200122/gtmessag.c:48:11:  [1] (buffer) wcslen:
  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).
    len = wcslen(msg);
data/glktermw-1.0.4+git20200122/gtmessin.c:57:43:  [1] (buffer) wcslen:
  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).
    orgx = LEFT_MARGIN + wcswidth(prompt, wcslen(prompt));
data/glktermw-1.0.4+git20200122/gtmessin.c:122:48:  [1] (buffer) wcslen:
  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).
    lin->orgx = LEFT_MARGIN + wcswidth(prompt, wcslen(prompt));
data/glktermw-1.0.4+git20200122/gtncursesw.c:82:33:  [1] (buffer) wcslen:
  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).
    return local_addnwstr(wstr, wcslen(wstr));
data/glktermw-1.0.4+git20200122/gtstream.c:260:13:  [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.
            strcpy(modestr, "w");
data/glktermw-1.0.4+git20200122/gtstream.c:263:13:  [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.
            strcpy(modestr, "r");
data/glktermw-1.0.4+git20200122/gtstream.c:276:9:  [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(modestr, "b");
data/glktermw-1.0.4+git20200122/gtstream.c:471:9:  [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.
        strcpy(modestr, "r");
data/glktermw-1.0.4+git20200122/gtstream.c:473:9:  [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.
        strcpy(modestr, "w");
data/glktermw-1.0.4+git20200122/gtstream.c:475:9:  [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(modestr, "b");
data/glktermw-1.0.4+git20200122/gtstream.c:1017:23:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                res = getc(str->file);
data/glktermw-1.0.4+git20200122/gtstream.c:1032:23:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                res = getc(str->file);
data/glktermw-1.0.4+git20200122/gtstream.c:1036:23:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                res = getc(str->file);
data/glktermw-1.0.4+git20200122/gtstream.c:1040:23:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                res = getc(str->file);
data/glktermw-1.0.4+git20200122/gtstream.c:1044:23:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                res = getc(str->file);
data/glktermw-1.0.4+git20200122/gtstream.c:1238:31:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                        res = getc(str->file);
data/glktermw-1.0.4+git20200122/gtstream.c:1253:27:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                    res = getc(str->file);
data/glktermw-1.0.4+git20200122/gtstream.c:1257:27:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                    res = getc(str->file);
data/glktermw-1.0.4+git20200122/gtstream.c:1261:27:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                    res = getc(str->file);
data/glktermw-1.0.4+git20200122/gtstream.c:1265:27:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                    res = getc(str->file);
data/glktermw-1.0.4+git20200122/gtstream.c:1480:30:  [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).
                        lx = strlen(cbuf);
data/glktermw-1.0.4+git20200122/gtstream.c:1494:31:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                        res = getc(str->file);
data/glktermw-1.0.4+git20200122/gtstream.c:1515:27:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                    res = getc(str->file);
data/glktermw-1.0.4+git20200122/gtstream.c:1519:27:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                    res = getc(str->file);
data/glktermw-1.0.4+git20200122/gtstream.c:1523:27:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                    res = getc(str->file);
data/glktermw-1.0.4+git20200122/gtstream.c:1527:27:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                    res = getc(str->file);
data/glktermw-1.0.4+git20200122/gtstream.c:1570: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).
    gli_put_buffer(gli_currentstr, s, strlen(s));
data/glktermw-1.0.4+git20200122/gtstream.c:1579:28:  [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).
    gli_put_buffer(str, s, strlen(s));
data/glktermw-1.0.4+git20200122/gtw_buf.c:1317:32:  [1] (buffer) wcslen:
  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).
            put_text(dwin, cx, wcslen(cx), dwin->infence, 
data/glktermw-1.0.4+git20200122/gtw_buf.c:1329:32:  [1] (buffer) wcslen:
  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).
            put_text(dwin, cx, wcslen(cx), dwin->infence, 
data/glktermw-1.0.4+git20200122/main.c:86: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).
                && !strncmp(argv[ix], argform->name, strlen(argform->name))
data/glktermw-1.0.4+git20200122/main.c:87: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).
                && (cx = argv[ix] + strlen(argform->name))
data/glktermw-1.0.4+git20200122/main.c:198:21:  [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(argform->name) == 0)
data/glktermw-1.0.4+git20200122/main.c:272: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).
    optlen = strlen(optname);

ANALYSIS SUMMARY:

Hits = 118
Lines analyzed = 24961 in approximately 0.64 seconds (39257 lines/second)
Physical Source Lines of Code (SLOC) = 22241
Hits@level = [0]  30 [1]  51 [2]  50 [3]   2 [4]  15 [5]   0
Hits@level+ = [0+] 148 [1+] 118 [2+]  67 [3+]  17 [4+]  15 [5+]   0
Hits/KSLOC@level+ = [0+] 6.65438 [1+] 5.30552 [2+] 3.01245 [3+] 0.764354 [4+] 0.67443 [5+]   0
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.