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/win-iconv-0.0.8/iconv.h
Examining data/win-iconv-0.0.8/mlang.h
Examining data/win-iconv-0.0.8/win_iconv_test.c
Examining data/win-iconv-0.0.8/win_iconv.c

FINAL RESULTS:

data/win-iconv-0.0.8/win_iconv.c:2036: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(tocode, p);
data/win-iconv-0.0.8/win_iconv_test.c:50:5:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
    sprintf(buf, "WINICONV_LIBICONV_DLL=%s", dllpath);
data/win-iconv-0.0.8/win_iconv.c:718:9:  [3] (misc) LoadLibrary:
  Ensure that the full path to the library is specified, or current directory
  may be used (CWE-829, CWE-20). Use registry entry or GetWindowsDirectory to
  find library path, if you aren't already.
    h = LoadLibrary(TEXT("mlang.dll"));
data/win-iconv-0.0.8/win_iconv.c:1162:9:  [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.
    p = getenv("WINICONV_LIBICONV_DLL");
data/win-iconv-0.0.8/win_iconv.c:1033:16:  [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).
        return atoi(name + 2); /* CP123 */
data/win-iconv-0.0.8/win_iconv.c:1035:16:  [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).
        return atoi(name);     /* 123 */
data/win-iconv-0.0.8/win_iconv.c:1037:16:  [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).
        return atoi(name + 2); /* XX123 for debug */
data/win-iconv-0.0.8/win_iconv.c:1135:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy(p, s, n);
data/win-iconv-0.0.8/win_iconv.c:1386:17:  [2] (buffer) MultiByteToWideChar:
  Requires maximum length in CHARACTERS, not bytes (CWE-120).
    *wbufsize = MultiByteToWideChar(cv->codepage, mbtowc_flags (cv->codepage),
data/win-iconv-0.0.8/win_iconv.c:1455: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 tmpbuf[MB_CHAR_MAX]; /* enough room for one character */
data/win-iconv-0.0.8/win_iconv.c:1468:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy(buf, tmpbuf, tmpsize);
data/win-iconv-0.0.8/win_iconv.c:1534: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, "\xFF\xFE", 2);
data/win-iconv-0.0.8/win_iconv.c:1536: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, "\xFE\xFF", 2);
data/win-iconv-0.0.8/win_iconv.c:1627: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, "\xFF\xFE\x00\x00", 4);
data/win-iconv-0.0.8/win_iconv.c:1629: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, "\x00\x00\xFE\xFF", 4);
data/win-iconv-0.0.8/win_iconv.c:1711: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 tmp[MB_CHAR_MAX];
data/win-iconv-0.0.8/win_iconv.c:1728:30:  [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.
                if (strncmp((char *)buf, iesc[i].esc, bufsize) == 0)
data/win-iconv-0.0.8/win_iconv.c:1733:30:  [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.
                if (strncmp((char *)buf, iesc[i].esc, esc_len) == 0)
data/win-iconv-0.0.8/win_iconv.c:1774:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy(tmp, iesc[cs].esc, esc_len);
data/win-iconv-0.0.8/win_iconv.c:1777: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(tmp + esc_len, iso2022_SO_seq, 1);
data/win-iconv-0.0.8/win_iconv.c:1780:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy(tmp + esc_len, buf, len);
data/win-iconv-0.0.8/win_iconv.c:1788: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(tmp, iesc[ISO2022JP_CS_JISX0201_KANA].esc, esc_len);
data/win-iconv-0.0.8/win_iconv.c:1789: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(tmp + esc_len, buf, len);
data/win-iconv-0.0.8/win_iconv.c:1815: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 tmp[MB_CHAR_MAX];
data/win-iconv-0.0.8/win_iconv.c:1889: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(tmp, iesc[ISO2022JP_CS_ASCII].esc, esc_len);
data/win-iconv-0.0.8/win_iconv.c:1895: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(tmp, iso2022_SI_seq, 1);
data/win-iconv-0.0.8/win_iconv.c:1902:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy(buf, tmp, len + esc_len);
data/win-iconv-0.0.8/win_iconv.c:1926: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, iso2022_SI_seq, 1);
data/win-iconv-0.0.8/win_iconv.c:1931: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 + esc_len, iesc[ISO2022JP_CS_ASCII].esc,
data/win-iconv-0.0.8/win_iconv.c:1968: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 inbuf[BUFSIZ];
data/win-iconv-0.0.8/win_iconv.c:1969: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 outbuf[BUFSIZ];
data/win-iconv-0.0.8/win_iconv.c:2002: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).
            out = fopen(argv[++i], "wb");
data/win-iconv-0.0.8/win_iconv.c:2011: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).
            in = fopen(argv[i], "rb");
data/win-iconv-0.0.8/win_iconv.c:2037:9:  [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(tocode, "//IGNORE");
data/win-iconv-0.0.8/win_iconv_test.c:17:12:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    static char buf[BUFSIZ];
data/win-iconv-0.0.8/win_iconv_test.c:22: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.
        pbuf += sprintf(pbuf, "%02X", str[i] & 0xFF);
data/win-iconv-0.0.8/win_iconv_test.c:29:12:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    static char buf[BUFSIZ];
data/win-iconv-0.0.8/win_iconv_test.c:37: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(buf, "%d\n", errcode);
data/win-iconv-0.0.8/win_iconv_test.c:47: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[BUFSIZ];
data/win-iconv-0.0.8/win_iconv_test.c:92: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 outbuf[BUFSIZ];
data/win-iconv-0.0.8/win_iconv_test.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 dllpath[_MAX_PATH];
data/win-iconv-0.0.8/win_iconv.c:929: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).
    name = xstrndup(_name, strlen(_name));
data/win-iconv-0.0.8/win_iconv.c:1118: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).
    int len = strlen(token);
data/win-iconv-0.0.8/win_iconv.c:1119:27:  [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).
    const char *p = str + strlen(str);
data/win-iconv-0.0.8/win_iconv.c:1172: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).
            e = p + strlen(p);
data/win-iconv-0.0.8/win_iconv.c:2030: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).
        tocode = (char *)malloc(strlen(p) + strlen("//IGNORE") + 1);
data/win-iconv-0.0.8/win_iconv.c:2030:45:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        tocode = (char *)malloc(strlen(p) + strlen("//IGNORE") + 1);

ANALYSIS SUMMARY:

Hits = 47
Lines analyzed = 2440 in approximately 0.11 seconds (21597 lines/second)
Physical Source Lines of Code (SLOC) = 2025
Hits@level = [0]  17 [1]   6 [2]  37 [3]   2 [4]   2 [5]   0
Hits@level+ = [0+]  64 [1+]  47 [2+]  41 [3+]   4 [4+]   2 [5+]   0
Hits/KSLOC@level+ = [0+] 31.6049 [1+] 23.2099 [2+] 20.2469 [3+] 1.97531 [4+] 0.987654 [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.