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/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_data.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_defines.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_funcobjs.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_funcobjs.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_glibHandler.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_keys.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_option_event.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_option_keys.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_options.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_options.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_plugin.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_plugin.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_uiobjects.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_uiobjects.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_view.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_view.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_view_classic.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_view_classic.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_winHandler.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/lattice_states.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/userdict.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/userdict.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/utils.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/ic_history.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/ic_history.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_context.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_context.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_data.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_option_event.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_winHandler.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/lattice_states.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/lexicon/genpyt.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/lexicon/pytrie.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/lexicon/pytrie.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/lexicon/pytrie_gen.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/lexicon/trie_writer.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/lexicon/trie_writer.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/lexicon/pytrie_gen.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/datrie.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/datrie_impl.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/hunpin_seg.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/hunpin_seg.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/pinyin_data.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/pinyin_data.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/pinyin_seg.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/pinyin_seg.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/segmentor.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/shuangpin_data.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/shuangpin_data.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/shuangpin_seg.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/shuangpin_seg.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/syllable.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/getwordfreq/getwordfreq.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/ids2ngram/idngram.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/ids2ngram/idngram_merge.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/ids2ngram/idngram_merge.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/ids2ngram/ids2ngram.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/mmseg/mmseg.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/sim_dict.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/sim_dict.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/sim_fmerge.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/sim_sen.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/sim_sen.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/sim_slm.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/sim_slm.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmbuild/sim_slmbuilder.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmbuild/sim_slmbuilder.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmbuild/slmbuild.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/slminfo/slminfo.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmpack/arpa_slm.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmpack/arpa_slm.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmpack/common.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmpack/slmpack.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmprune/slmprune.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmseg/slmseg.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/thread/ValueCompress.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/thread/test_vc.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/thread/slmthread.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/thread/ValueCompress.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/tools/clean_rmrb.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/tools/dumpdict.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/tslmendian/slm_endian.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/tslmendian/slm_file.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/tslmendian/slm_file.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/tslmendian/writer.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/tslmendian/writer.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/tslminfo/tslminfo.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/slm.cpp
Examining data/sunpinyin-3.0.0~rc1+ds1/src/slm/slm.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/sunpinyin.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/portability.h
Examining data/sunpinyin-3.0.0~rc1+ds1/src/portability.cpp

FINAL RESULTS:

data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_options.cpp:192:13:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
        if (access(path, F_OK) != 0 && mkdir(path, S_IRWXU) != 0) {
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_options.cpp:198:14:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
    return !(access(path, F_OK) != 0 && mkdir(path, S_IRWXU) != 0);
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/userdict.cpp:126:9:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
        sprintf(sql, "%s%d;", sql, (wid - INI_USRDEF_WID));
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/shuangpin_data.cpp:303:25:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
                        sprintf(buf, "%s%s", initials[i], finals[j]);
data/sunpinyin-3.0.0~rc1+ds1/src/portability.h:59:41:  [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.
        #define DEBUG_print(fmt, ...)   fprintf(stderr, fmt, ...)
data/sunpinyin-3.0.0~rc1+ds1/src/portability.h:65:43:  [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.
        #define DEBUG_print(fmt, a ...)   fprintf(stderr, fmt, a ...)
data/sunpinyin-3.0.0~rc1+ds1/src/slm/tslminfo/tslminfo.cpp:315:13:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
            printf(
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_options.cpp:76:28:  [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.
        const char *home = getenv("HOME");
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_plugin.cpp:254:41:  [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.
    eval_str << "sys.path.append(r'" << getenv("HOME")
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_plugin.cpp:279:36:  [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.
    std::string plugin_list_path = getenv("HOME");
data/sunpinyin-3.0.0~rc1+ds1/src/lexicon/genpyt.cpp:126:19:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((opt = getopt(argc, argv, "i:o:l:s:e:")) != -1) {
data/sunpinyin-3.0.0~rc1+ds1/src/slm/getwordfreq/getwordfreq.cpp:77:18:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((ch = getopt(argc, argv, "m:l:s:ve")) != -1) {
data/sunpinyin-3.0.0~rc1+ds1/src/slm/ids2ngram/idngram_merge.cpp:92:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
                getopt_long(argc, argv, "n:o:", long_options,
data/sunpinyin-3.0.0~rc1+ds1/src/slm/ids2ngram/ids2ngram.cpp:149:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
                getopt_long(argc, argv, "p:n:s:o:", long_options,
data/sunpinyin-3.0.0~rc1+ds1/src/slm/mmseg/mmseg.cpp:128:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
                getopt_long(argc, argv, "d:if:s:a:", long_options,
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmbuild/slmbuild.cpp:144:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
                getopt_long(argc, argv, "lw:n:c:d:o:b:e:", long_options,
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slminfo/slminfo.cpp:96:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
                getopt_long(argc, argv, "vpl:", long_options,
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmseg/slmseg.cpp:124:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
                getopt_long(argc, argv, "d:if:s:m:", long_options,
data/sunpinyin-3.0.0~rc1+ds1/src/slm/thread/test_vc.cpp:63: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(1024);
data/sunpinyin-3.0.0~rc1+ds1/src/slm/tslmendian/slm_endian.cpp:102:19:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((opt = getopt(argc, argv, "e:i:o:v")) != -1) {
data/sunpinyin-3.0.0~rc1+ds1/src/slm/tslminfo/tslminfo.cpp:197:17:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
                getopt_long(argc, argv, "vpl:", long_options,
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/ic_history.cpp:180:14:  [2] (misc) open:
  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).
    int fd = open(fname, O_CREAT, 0600);
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/ic_history.cpp:209:20:  [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* fp = fopen(fname, "wb");
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_data.cpp:53: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[512];
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_options.cpp:75: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 path[256];
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_plugin.cpp:281: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).
    FILE* fp = fopen(plugin_list_path.c_str(), "r");
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_plugin.cpp:286: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 plugin_name[PLUGIN_NAME_LEN];
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/lattice_states.cpp:93: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 valbuf[256];
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/userdict.cpp:104: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[MAX_USRDEF_WORD_LEN * 6 + 1];
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/userdict.cpp:123: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 sql[256] = "DELETE FROM dict WHERE id=";
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/userdict.cpp:146: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[256];
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/userdict.cpp:152:9:  [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, " and i%d=%d", i, syllables[i].initial);
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/userdict.cpp:158:9:  [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, " and f%i=%i", i, syllables[i].final);
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/userdict.cpp:164:9:  [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, " and t%i=%i", i, syllables[i].tone);
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/userdict.cpp:217: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 sql_str[256];
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/userdict.cpp:228: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(sql_str, "SELECT utf8str FROM dict WHERE id=%d;", wid);
data/sunpinyin-3.0.0~rc1+ds1/src/lexicon/genpyt.cpp:56:5:  [2] (misc) open:
  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).
    open(const char* lm_file)
data/sunpinyin-3.0.0~rc1+ds1/src/lexicon/genpyt.cpp:152:14:  [2] (misc) open:
  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 (!srt.open(slm_file)) {
data/sunpinyin-3.0.0~rc1+ds1/src/lexicon/genpyt.cpp:179: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).
    FILE *fp = fopen(log_file, "w");
data/sunpinyin-3.0.0~rc1+ds1/src/lexicon/pytrie.cpp:80:14:  [2] (misc) open:
  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).
    int fd = open(fname, O_RDONLY);
data/sunpinyin-3.0.0~rc1+ds1/src/lexicon/pytrie.cpp:124: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[1024];
data/sunpinyin-3.0.0~rc1+ds1/src/lexicon/pytrie_gen.cpp:71: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 gbstr[256];
data/sunpinyin-3.0.0~rc1+ds1/src/lexicon/pytrie_gen.cpp:72: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 utstr[256];
data/sunpinyin-3.0.0~rc1+ds1/src/lexicon/pytrie_gen.cpp:148:10:  [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).
    id = atoi(p);
data/sunpinyin-3.0.0~rc1+ds1/src/lexicon/pytrie_gen.cpp:186: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[4096];
data/sunpinyin-3.0.0~rc1+ds1/src/lexicon/pytrie_gen.cpp:187: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 word_buf[2048];
data/sunpinyin-3.0.0~rc1+ds1/src/lexicon/pytrie_gen.cpp:192: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).
    FILE *fp = fopen(fileName, "r");
data/sunpinyin-3.0.0~rc1+ds1/src/lexicon/pytrie_gen.cpp:439: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).
    FILE* fp = fopen(fileName, "wb");
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/datrie_impl.h:59:14:  [2] (misc) open:
  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).
    int fd = open(fname, O_RDONLY);
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/hunpin_seg.cpp:243: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.
                char buf[4];
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/hunpin_seg.cpp:244: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(buf, "%c%c", m_pystr[(*it).m_start],
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/pinyin_data.cpp:71: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[128];
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/shuangpin_data.cpp:52: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 *initials[INITIAL_NUM] =
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/shuangpin_data.cpp:57: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 *finals[FINAL_NUM] = { "", "a", "o", "e", "ai", "ei", "ao",
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/shuangpin_data.cpp:66: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 ms2003_mapinitials[INITIAL_NUM] =
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/shuangpin_data.cpp:72: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 ms2003_mapfinals[FINAL_NUM] =
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/shuangpin_data.cpp:96: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 abc_mapinitials[INITIAL_NUM] =
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/shuangpin_data.cpp:102: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 abc_mapfinals[FINAL_NUM] =
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/shuangpin_data.cpp:125: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 ziguang_mapinitials[INITIAL_NUM] =
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/shuangpin_data.cpp:131: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 ziguang_mapfinals[FINAL_NUM] =
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/shuangpin_data.cpp:154: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 pyjiajia_mapinitials[INITIAL_NUM] =
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/shuangpin_data.cpp:160: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 pyjiajia_mapfinals[FINAL_NUM] =
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/shuangpin_data.cpp:183: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 ziranma_mapinitials[INITIAL_NUM] =
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/shuangpin_data.cpp:189: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 ziranma_mapfinals[FINAL_NUM] =
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/shuangpin_data.cpp:212: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 xiaohe_mapinitials[INITIAL_NUM] =
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/shuangpin_data.cpp:218:14:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
static const char xiaohe_mapfinals[FINAL_NUM] =
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/shuangpin_data.cpp:276: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[32] = "\0";
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/shuangpin_seg.cpp:316: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 buf[4];
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/shuangpin_seg.cpp:318: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(buf, "%c%c", m_pystr[len - 2], ch);
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/shuangpin_seg.cpp:320: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(buf, "%c", ch);
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/syllable.h:133:16:  [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[128];
data/sunpinyin-3.0.0~rc1+ds1/src/portability.cpp:116: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[256];
data/sunpinyin-3.0.0~rc1+ds1/src/portability.h:139:16:  [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 (buf) sprintf(buf, "%10lf*2^%d", m_base, m_exp); }
data/sunpinyin-3.0.0~rc1+ds1/src/portability.h:241:40:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        return static_cast<char_type*>(memcpy(__s1, __s2, __n *
data/sunpinyin-3.0.0~rc1+ds1/src/slm/getwordfreq/getwordfreq.cpp:84:27:  [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).
            corpus_size = atoi(optarg); break;
data/sunpinyin-3.0.0~rc1+ds1/src/slm/getwordfreq/getwordfreq.cpp:96: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 buf[8192];
data/sunpinyin-3.0.0~rc1+ds1/src/slm/getwordfreq/getwordfreq.cpp:108:22:  [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).
            int id = atoi(idstr);
data/sunpinyin-3.0.0~rc1+ds1/src/slm/getwordfreq/getwordfreq.cpp:149:43:  [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 (slm.load(slm_file, true) && (fp = fopen(lexicon_file, "r")) != NULL) {
data/sunpinyin-3.0.0~rc1+ds1/src/slm/ids2ngram/idngram_merge.cpp:96:17:  [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).
            N = atoi(strdup(optarg));
data/sunpinyin-3.0.0~rc1+ds1/src/slm/ids2ngram/idngram_merge.cpp:116: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).
    FILE *out = fopen(output, "wb+");
data/sunpinyin-3.0.0~rc1+ds1/src/slm/ids2ngram/idngram_merge.cpp:122:20:  [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 *fp = fopen(argv[optind++], "rb");
data/sunpinyin-3.0.0~rc1+ds1/src/slm/ids2ngram/ids2ngram.cpp:153:17:  [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).
            N = atoi(strdup(optarg));
data/sunpinyin-3.0.0~rc1+ds1/src/slm/ids2ngram/ids2ngram.cpp:156:23:  [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).
            paraMax = atoi(strdup(optarg));
data/sunpinyin-3.0.0~rc1+ds1/src/slm/ids2ngram/ids2ngram.cpp:178: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).
    FILE *swap = fopen(swapfile, "wb+");
data/sunpinyin-3.0.0~rc1+ds1/src/slm/ids2ngram/ids2ngram.cpp:179: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).
    FILE *out = fopen(output, "wb+");
data/sunpinyin-3.0.0~rc1+ds1/src/slm/ids2ngram/ids2ngram.cpp:183:20:  [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 *fp = fopen(argv[optind], "rb");
data/sunpinyin-3.0.0~rc1+ds1/src/slm/mmseg/mmseg.cpp:141:25:  [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).
            s_iSTOKID = atoi(optarg);
data/sunpinyin-3.0.0~rc1+ds1/src/slm/mmseg/mmseg.cpp:144:25:  [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).
            s_iAmbiID = atoi(optarg);
data/sunpinyin-3.0.0~rc1+ds1/src/slm/mmseg/mmseg.cpp:175: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 mbword[1024];
data/sunpinyin-3.0.0~rc1+ds1/src/slm/mmseg/mmseg.cpp:302:24:  [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 *fp = fopen(argv[i], "r");
data/sunpinyin-3.0.0~rc1+ds1/src/slm/sim_dict.cpp:91: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[1024];
data/sunpinyin-3.0.0~rc1+ds1/src/slm/sim_dict.cpp:96: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).
        if ((fp = fopen(filename, "r")) == NULL)
data/sunpinyin-3.0.0~rc1+ds1/src/slm/sim_slm.cpp:47: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).
    FILE* fp = fopen(fname, "rb");
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slm.cpp:57:14:  [2] (misc) open:
  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).
    int fd = open(fname, O_RDONLY);
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmbuild/slmbuild.cpp:156:17:  [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).
            N = atoi(optarg);
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmbuild/slmbuild.cpp:160:17:  [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).
            n = atoi(optarg);
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmbuild/slmbuild.cpp:167:23:  [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).
                cut = atoi(ac);
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmbuild/slmbuild.cpp:178: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).
                n = atoi(ac);
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmbuild/slmbuild.cpp:189: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).
                n = atoi(ac);
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmbuild/slmbuild.cpp:201:24:  [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).
                rmax = atoi(ac);
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmbuild/slmbuild.cpp:242: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).
    FILE *fp = fopen(inputfilename, "rb");
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmbuild/slmbuild.cpp:256: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).
    FILE *out = fopen(outfilename, "wb");
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slminfo/slminfo.cpp:211: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 word[10240];
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slminfo/slminfo.cpp:217:23:  [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_lex = fopen(lexicon_filename, "r");
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slminfo/slminfo.cpp:268: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).
    if ((fp = fopen(argv[argc - 1], "rb+")) == NULL) {
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmpack/arpa_slm.cpp:93: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[1024];
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmpack/arpa_slm.cpp:104: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[1024];
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmpack/arpa_slm.cpp:116: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[1024];
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmpack/arpa_slm.cpp:127: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[1024];
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmpack/slmpack.cpp:77: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 word[1024 * 10];
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmpack/slmpack.cpp:78: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_lex = fopen(filename, "r");
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmpack/slmpack.cpp:119: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).
    FILE* fp = fopen(filename, "wb");
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmprune/slmprune.cpp:122: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).
    FILE* out = fopen(filename, "wb");
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmprune/slmprune.cpp:475:23:  [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).
        nCut[i - 3] = atoi(argv[i]);
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmseg/slmseg.cpp:137:25:  [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).
            s_iSTOKID = atoi(optarg);
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmseg/slmseg.cpp:171: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 mbword[1024];
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmseg/slmseg.cpp:466:24:  [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 *fp = fopen(argv[i], "r");
data/sunpinyin-3.0.0~rc1+ds1/src/slm/thread/slmthread.cpp:430: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).
    fp = fopen(argv[2], "wb");
data/sunpinyin-3.0.0~rc1+ds1/src/slm/tools/clean_rmrb.cpp:79: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.
    unsigned char buf[10240];
data/sunpinyin-3.0.0~rc1+ds1/src/slm/tools/clean_rmrb.cpp:81:20:  [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 *fp = fopen(argv[i], "r");
data/sunpinyin-3.0.0~rc1+ds1/src/slm/tslmendian/slm_file.cpp:250:14:  [2] (misc) open:
  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).
    int fd = open(fname, O_RDONLY);
data/sunpinyin-3.0.0~rc1+ds1/src/slm/tslmendian/slm_file.cpp:285: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).
    FILE* fp = fopen(fname, "wb");
data/sunpinyin-3.0.0~rc1+ds1/src/slm/tslminfo/tslminfo.cpp:227: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 word[10240];
data/sunpinyin-3.0.0~rc1+ds1/src/slm/tslminfo/tslminfo.cpp:232:23:  [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_lex = fopen(lexicon_filename, "r");
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/ic_history.cpp:191:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        read(fd, buf, info.st_size);
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_plugin.cpp:289: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).
        if (strlen(plugin_name) == 0) {
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_plugin.cpp:292: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).
        if (strlen(plugin_name) == 1) {
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/imi_plugin.cpp:295: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).
        plugin_name[strlen(plugin_name) - 1] = 0; // remove the \n at the end
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/userdict.cpp:88:36:  [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).
    sqlite3_prepare(m_db, sql_str, strlen(sql_str), &stmt, &tail);
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/userdict.cpp:106:50:  [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).
    sqlite3_bind_text(stmt, i, (const char*)buf, strlen(buf), NULL);
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/userdict.cpp:175:41:  [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).
    rc = sqlite3_prepare(m_db, sql_str, strlen(sql_str), &stmt, &tail);
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/userdict.cpp:230:41:  [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).
    rc = sqlite3_prepare(m_db, sql_str, strlen(sql_str), &stmt, &tail);
data/sunpinyin-3.0.0~rc1+ds1/src/ime-core/utils.h:104:10:  [1] (buffer) equal:
  Function does not check the second iterator for over-read conditions
  (CWE-126). This function is often discouraged by most C++ coding standards
  in favor of its safer alternatives provided since C++14. Consider using a
  form of this function that checks the second iterator before potentially
  overflowing it.
    bool equal(const this_type p) const
data/sunpinyin-3.0.0~rc1+ds1/src/lexicon/pytrie.cpp:93:19:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    suc = suc && (read(fd, m_mem, m_Size) > 0);
data/sunpinyin-3.0.0~rc1+ds1/src/lexicon/pytrie.cpp:158: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).
        prefix.resize(prefix.size() - strlen(str) - 1);
data/sunpinyin-3.0.0~rc1+ds1/src/lexicon/pytrie_gen.cpp:75: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).
    size_t srclen = strlen((char*)src) + 1;
data/sunpinyin-3.0.0~rc1+ds1/src/lexicon/pytrie_gen.cpp:83:18:  [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).
        srclen = strlen((char*)src) + 1;
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/datrie_impl.h:72:19:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    suc = suc && (read(fd, m_mem, m_memSize) > 0);
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/datrie_impl.h: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).
    return match_longest(str, str + strlen(str), length);
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/pinyin_seg.cpp:252:41:  [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).
                _clear(m_pystr.size() - strlen(v));
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/pinyin_seg.cpp:258:26:  [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 (l != strlen(v)) {
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/pinyin_seg.cpp:260: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).
                    m_segs.back().m_len += l - strlen(v);
data/sunpinyin-3.0.0~rc1+ds1/src/pinyin/shuangpin_data.cpp:275: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(shpstr);
data/sunpinyin-3.0.0~rc1+ds1/src/portability.cpp:143:26:  [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 srclen = std::strlen(s) + 1;
data/sunpinyin-3.0.0~rc1+ds1/src/slm/ids2ngram/idngram.h:96:10:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    bool read(FILE *fp, size_t& start_offset, size_t last_offset){
data/sunpinyin-3.0.0~rc1+ds1/src/slm/sim_fmerge.h:78:46:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                e.runOut = runOut = !(e.unit.read(fp, cur_offset, last_offset));
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slm.cpp:88:25:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            ssize_t n = read(fd, p, len);
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slm.cpp:101:13:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        if (read(fd, m_buf, m_bufSize) != m_bufSize) {
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slminfo/slminfo.cpp:219:17:  [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(word) > 0) {
data/sunpinyin-3.0.0~rc1+ds1/src/slm/slmpack/slmpack.cpp:81: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).
        if (strlen(word) > 0) {
data/sunpinyin-3.0.0~rc1+ds1/src/slm/tslmendian/slm_file.cpp:254:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    if (read(fd, m_buf, len) != len) {
data/sunpinyin-3.0.0~rc1+ds1/src/slm/tslminfo/tslminfo.cpp:234:17:  [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(word) > 0) {

ANALYSIS SUMMARY:

Hits = 152
Lines analyzed = 19845 in approximately 1.44 seconds (13792 lines/second)
Physical Source Lines of Code (SLOC) = 13528
Hits@level = [0] 370 [1]  28 [2] 103 [3]  14 [4]   7 [5]   0
Hits@level+ = [0+] 522 [1+] 152 [2+] 124 [3+]  21 [4+]   7 [5+]   0
Hits/KSLOC@level+ = [0+] 38.5866 [1+] 11.236 [2+] 9.16617 [3+] 1.55234 [4+] 0.517445 [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.