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/shadowsocks-libev-3.3.5+ds/src/acl.c
Examining data/shadowsocks-libev-3.3.5+ds/src/acl.h
Examining data/shadowsocks-libev-3.3.5+ds/src/aead.c
Examining data/shadowsocks-libev-3.3.5+ds/src/aead.h
Examining data/shadowsocks-libev-3.3.5+ds/src/android.c
Examining data/shadowsocks-libev-3.3.5+ds/src/base64.c
Examining data/shadowsocks-libev-3.3.5+ds/src/base64.h
Examining data/shadowsocks-libev-3.3.5+ds/src/cache.c
Examining data/shadowsocks-libev-3.3.5+ds/src/cache.h
Examining data/shadowsocks-libev-3.3.5+ds/src/common.h
Examining data/shadowsocks-libev-3.3.5+ds/src/crypto.c
Examining data/shadowsocks-libev-3.3.5+ds/src/crypto.h
Examining data/shadowsocks-libev-3.3.5+ds/src/jconf.c
Examining data/shadowsocks-libev-3.3.5+ds/src/jconf.h
Examining data/shadowsocks-libev-3.3.5+ds/src/local.c
Examining data/shadowsocks-libev-3.3.5+ds/src/local.h
Examining data/shadowsocks-libev-3.3.5+ds/src/manager.c
Examining data/shadowsocks-libev-3.3.5+ds/src/manager.h
Examining data/shadowsocks-libev-3.3.5+ds/src/netutils.c
Examining data/shadowsocks-libev-3.3.5+ds/src/netutils.h
Examining data/shadowsocks-libev-3.3.5+ds/src/plugin.c
Examining data/shadowsocks-libev-3.3.5+ds/src/plugin.h
Examining data/shadowsocks-libev-3.3.5+ds/src/ppbloom.c
Examining data/shadowsocks-libev-3.3.5+ds/src/ppbloom.h
Examining data/shadowsocks-libev-3.3.5+ds/src/redir.c
Examining data/shadowsocks-libev-3.3.5+ds/src/redir.h
Examining data/shadowsocks-libev-3.3.5+ds/src/resolv.c
Examining data/shadowsocks-libev-3.3.5+ds/src/resolv.h
Examining data/shadowsocks-libev-3.3.5+ds/src/rule.c
Examining data/shadowsocks-libev-3.3.5+ds/src/rule.h
Examining data/shadowsocks-libev-3.3.5+ds/src/server.c
Examining data/shadowsocks-libev-3.3.5+ds/src/server.h
Examining data/shadowsocks-libev-3.3.5+ds/src/shadowsocks.h
Examining data/shadowsocks-libev-3.3.5+ds/src/socks5.h
Examining data/shadowsocks-libev-3.3.5+ds/src/stream.c
Examining data/shadowsocks-libev-3.3.5+ds/src/stream.h
Examining data/shadowsocks-libev-3.3.5+ds/src/tunnel.c
Examining data/shadowsocks-libev-3.3.5+ds/src/tunnel.h
Examining data/shadowsocks-libev-3.3.5+ds/src/udprelay.c
Examining data/shadowsocks-libev-3.3.5+ds/src/udprelay.h
Examining data/shadowsocks-libev-3.3.5+ds/src/uthash.h
Examining data/shadowsocks-libev-3.3.5+ds/src/utils.c
Examining data/shadowsocks-libev-3.3.5+ds/src/utils.h
Examining data/shadowsocks-libev-3.3.5+ds/src/winsock.c
Examining data/shadowsocks-libev-3.3.5+ds/src/winsock.h

FINAL RESULTS:

data/shadowsocks-libev-3.3.5+ds/src/acl.c:68: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(host, str);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:508:9:  [4] (shell) system:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
    if (system(cmd) == -1) {
data/shadowsocks-libev-3.3.5+ds/src/manager.c:668:13:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
            sprintf(buf + pos, "\n\t{\"server_port\":\"%s\",\"password\":\"%s\",\"method\":\"%s\"},",
data/shadowsocks-libev-3.3.5+ds/src/manager.c:732:17:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
                sprintf(buf + pos, "\"%s\":%" PRIu64 ",", server->port, server->traffic);
data/shadowsocks-libev-3.3.5+ds/src/plugin.c:191:5:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
    snprintf(buf, buf_size, TEMPDIR "%s_%s:%s_%s:%s", plugin,
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:1162:13:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
            strcpy(src, get_addr_str((struct sockaddr *)&src_addr, true));
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:1163:13:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
            strcpy(dst, get_addr_str((struct sockaddr *)&dst_addr, true));
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:1175:13:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
            strcpy(src, get_addr_str((struct sockaddr *)&src_addr, true));
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:1176:13:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
            strcpy(dst, get_addr_str((struct sockaddr *)&dst_addr, true));
data/shadowsocks-libev-3.3.5+ds/src/uthash.h:399:29:  [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 HASH_OOPS(...) do { fprintf(stderr,__VA_ARGS__); exit(-1); } while (0)
data/shadowsocks-libev-3.3.5+ds/src/utils.c:549:9:  [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(userconf, F_OK) != -1)
data/shadowsocks-libev-3.3.5+ds/src/utils.h:105:9:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
        fprintf(stdout, format "\n", ## __VA_ARGS__);        \
data/shadowsocks-libev-3.3.5+ds/src/utils.h:118:9:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
        fprintf(stderr, format "\n", ## __VA_ARGS__);         \
data/shadowsocks-libev-3.3.5+ds/src/utils.h:150:13:  [4] (format) syslog:
  If syslog's format strings can be influenced by an attacker, they can be
  exploited (CWE-134). Use a constant format string for syslog.
            syslog(LOG_INFO, format, ## __VA_ARGS__);                            \
data/shadowsocks-libev-3.3.5+ds/src/utils.h:171:13:  [4] (format) syslog:
  If syslog's format strings can be influenced by an attacker, they can be
  exploited (CWE-134). Use a constant format string for syslog.
            syslog(LOG_ERR, format, ## __VA_ARGS__);                              \
data/shadowsocks-libev-3.3.5+ds/src/local.c:1429: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(time(NULL));
data/shadowsocks-libev-3.3.5+ds/src/local.c:1451: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.
    while ((c = getopt_long(argc, argv, "f:s:p:l:k:t:m:i:c:b:a:n:S:huUvV6A",
data/shadowsocks-libev-3.3.5+ds/src/local.c:1454: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.
    while ((c = getopt_long(argc, argv, "f:s:p:l:k:t:m:i:c:b:a:n:huUv6A",
data/shadowsocks-libev-3.3.5+ds/src/local.c:1955: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(time(NULL));
data/shadowsocks-libev-3.3.5+ds/src/manager.c:904: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.
    while ((c = getopt_long(argc, argv, "f:s:l:k:t:m:c:i:d:a:n:D:6huUvA",
data/shadowsocks-libev-3.3.5+ds/src/redir.c:868: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(time(NULL));
data/shadowsocks-libev-3.3.5+ds/src/redir.c:917: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.
    while ((c = getopt_long(argc, argv, "f:s:p:l:k:t:m:c:b:a:n:huUTv6A",
data/shadowsocks-libev-3.3.5+ds/src/server.c:1600: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.
    while ((c = getopt_long(argc, argv, "f:s:p:l:k:t:m:b:c:i:d:a:n:huUv6A",
data/shadowsocks-libev-3.3.5+ds/src/tunnel.c:861: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(time(NULL));
data/shadowsocks-libev-3.3.5+ds/src/tunnel.c:912: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.
    while ((c = getopt_long(argc, argv, "f:s:p:l:k:t:m:i:c:b:L:a:n:huUvV6A",
data/shadowsocks-libev-3.3.5+ds/src/tunnel.c:915: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.
    while ((c = getopt_long(argc, argv, "f:s:p:l:k:t:m:i:c:b:L:a:n:huUv6A",
data/shadowsocks-libev-3.3.5+ds/src/utils.c:528:17:  [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.
    conf_home = getenv("XDG_CONFIG_HOME");
data/shadowsocks-libev-3.3.5+ds/src/utils.c:534: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.
            buf_size = 50 + strlen(getenv("HOME"));
data/shadowsocks-libev-3.3.5+ds/src/utils.c:537:46:  [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.
        snprintf(userconf, buf_size, "%s%s", getenv("HOME"),
data/shadowsocks-libev-3.3.5+ds/src/acl.c:71: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(host, str, ret);
data/shadowsocks-libev-3.3.5+ds/src/acl.c:73: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).
        *cidr     = atoi(str + ret + 1);
data/shadowsocks-libev-3.3.5+ds/src/acl.c:125: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).
    FILE *f = fopen(path, "r");
data/shadowsocks-libev-3.3.5+ds/src/acl.c:131: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_HOSTNAME_LEN];
data/shadowsocks-libev-3.3.5+ds/src/acl.c:195:13:  [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 host[MAX_HOSTNAME_LEN];
data/shadowsocks-libev-3.3.5+ds/src/aead.c:107:7:  [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.
const char *supported_aead_ciphers[AEAD_CIPHER_NUM] = {
data/shadowsocks-libev-3.3.5+ds/src/aead.c:120: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 *supported_aead_ciphers_mbedtls[AEAD_CIPHER_NUM] = {
data/shadowsocks-libev-3.3.5+ds/src/aead.c:414: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(ciphertext->data, cipher_ctx.salt, salt_len);
data/shadowsocks-libev-3.3.5+ds/src/aead.c:434: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(plaintext->data, ciphertext->data, salt_len + ciphertext->len);
data/shadowsocks-libev-3.3.5+ds/src/aead.c:461: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(salt, ciphertext->data, salt_len);
data/shadowsocks-libev-3.3.5+ds/src/aead.c:485: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(ciphertext->data, plaintext->data, plaintext->len);
data/shadowsocks-libev-3.3.5+ds/src/aead.c:504: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(len_buf, &t, CHUNK_SIZE_LEN);
data/shadowsocks-libev-3.3.5+ds/src/aead.c:559: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(ciphertext->data, cipher_ctx->salt, salt_len);
data/shadowsocks-libev-3.3.5+ds/src/aead.c:574: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(plaintext->data, ciphertext->data, ciphertext->len);
data/shadowsocks-libev-3.3.5+ds/src/aead.c:643: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(cipher_ctx->chunk->data + cipher_ctx->chunk->len,
data/shadowsocks-libev-3.3.5+ds/src/aead.c:654: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(cipher_ctx->salt, cipher_ctx->chunk->data, salt_len);
data/shadowsocks-libev-3.3.5+ds/src/aead.c:707: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(ciphertext->data, plaintext->data, plaintext->len);
data/shadowsocks-libev-3.3.5+ds/src/cache.c:282: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(entry->key, key, key_len);
data/shadowsocks-libev-3.3.5+ds/src/crypto.c:86: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(dst->data, src->data, src->len);
data/shadowsocks-libev-3.3.5+ds/src/crypto.c:102:21:  [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 m[16];
data/shadowsocks-libev-3.3.5+ds/src/crypto.c:122:15:  [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 ((fd = open("/dev/random", O_RDONLY)) != -1) {
data/shadowsocks-libev-3.3.5+ds/src/crypto.c:173: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(crypto, &tmp, sizeof(crypto_t));
data/shadowsocks-libev-3.3.5+ds/src/crypto.c:196: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(crypto, &tmp, sizeof(crypto_t));
data/shadowsocks-libev-3.3.5+ds/src/crypto.c:217: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 md_buf[MAX_MD_SIZE];
data/shadowsocks-libev-3.3.5+ds/src/crypto.c:255: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 prk[MBEDTLS_MD_MAX_SIZE];
data/shadowsocks-libev-3.3.5+ds/src/crypto.c:269: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 null_salt[MBEDTLS_MD_MAX_SIZE] = { '\0' };
data/shadowsocks-libev-3.3.5+ds/src/crypto.c:295: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 T[MBEDTLS_MD_MAX_SIZE];
data/shadowsocks-libev-3.3.5+ds/src/crypto.c:345: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(okm + where, T, (i != N) ? hash_len : (okm_len - where));
data/shadowsocks-libev-3.3.5+ds/src/crypto.c:364: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(key, out, key_len);
data/shadowsocks-libev-3.3.5+ds/src/crypto.c:372: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 out_key[out_len];
data/shadowsocks-libev-3.3.5+ds/src/jconf.c:165: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).
    FILE *f = fopen(file, "rb");
data/shadowsocks-libev-3.3.5+ds/src/jconf.c:196: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 error_buf[512];
data/shadowsocks-libev-3.3.5+ds/src/local.c:300: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(resp_buf->data, response, sizeof(struct socks5_response));
data/shadowsocks-libev-3.3.5+ds/src/local.c:301: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(resp_buf->data + sizeof(struct socks5_response),
data/shadowsocks-libev-3.3.5+ds/src/local.c:303: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(resp_buf->data + sizeof(struct socks5_response) +
data/shadowsocks-libev-3.3.5+ds/src/local.c:362: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 host[MAX_HOSTNAME_LEN + 1], ip[INET6_ADDRSTRLEN], port[16];
data/shadowsocks-libev-3.3.5+ds/src/local.c:377: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(abuf->data + abuf->len, buf->data + request_len, in_addr_len + 2);
data/shadowsocks-libev-3.3.5+ds/src/local.c:387: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(port, "%d", p);
data/shadowsocks-libev-3.3.5+ds/src/local.c:395: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(abuf->data + abuf->len, buf->data + request_len + 1, name_len + 2);
data/shadowsocks-libev-3.3.5+ds/src/local.c:400: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(host, buf->data + request_len + 1, name_len);
data/shadowsocks-libev-3.3.5+ds/src/local.c:402: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(port, "%d", p);
data/shadowsocks-libev-3.3.5+ds/src/local.c:409: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(abuf->data + abuf->len, buf->data + request_len, in6_addr_len + 2);
data/shadowsocks-libev-3.3.5+ds/src/local.c:419: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(port, "%d", p);
data/shadowsocks-libev-3.3.5+ds/src/local.c:560: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(remote->buf->data, buf->data, buf->len);
data/shadowsocks-libev-3.3.5+ds/src/local.c:1314: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(&(remote->addr), remote_addr, remote->addr_len);
data/shadowsocks-libev-3.3.5+ds/src/local.c:1360: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[1];
data/shadowsocks-libev-3.3.5+ds/src/local.c:1422: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_port[8];
data/shadowsocks-libev-3.3.5+ds/src/local.c:1466: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).
            mtu = atoi(optarg);
data/shadowsocks-libev-3.3.5+ds/src/local.c:1528: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).
            nofile = atoi(optarg);
data/shadowsocks-libev-3.3.5+ds/src/local.c:1836:26:  [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).
    listen_ctx.timeout = atoi(timeout);
data/shadowsocks-libev-3.3.5+ds/src/local.c:1974: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 local_port_str[16];
data/shadowsocks-libev-3.3.5+ds/src/local.c:1975: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 remote_port_str[16];
data/shadowsocks-libev-3.3.5+ds/src/local.c:1976: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(local_port_str, "%d", local_port);
data/shadowsocks-libev-3.3.5+ds/src/local.c:1977: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(remote_port_str, "%d", remote_port);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:107: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).
    FILE *f = fopen(path, "w+");
data/shadowsocks-libev-3.3.5+ds/src/manager.c:116:41:  [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).
    fprintf(f, "\"server_port\":%d,\n", atoi(server->port));
data/shadowsocks-libev-3.3.5+ds/src/manager.c:146: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 cmd[BUF_SIZE];
data/shadowsocks-libev-3.3.5+ds/src/manager.c:150:12:  [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).
    port = atoi(server->port);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:269: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 error_buf[512];
data/shadowsocks-libev-3.3.5+ds/src/manager.c:340: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 error_buf[512];
data/shadowsocks-libev-3.3.5+ds/src/manager.c:523: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).
    FILE *f = fopen(path, "r");
data/shadowsocks-libev-3.3.5+ds/src/manager.c:546: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).
    FILE *f = fopen(path, "r");
data/shadowsocks-libev-3.3.5+ds/src/manager.c:597: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[BUF_SIZE];
data/shadowsocks-libev-3.3.5+ds/src/manager.c:650: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[BUF_SIZE];
data/shadowsocks-libev-3.3.5+ds/src/manager.c:673: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 + max(pos - 1, 1), "\n]"); // Remove trailing ","
data/shadowsocks-libev-3.3.5+ds/src/manager.c:695: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 msg[3] = "ok";
data/shadowsocks-libev-3.3.5+ds/src/manager.c:700: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 port[8];
data/shadowsocks-libev-3.3.5+ds/src/manager.c:714: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[BUF_SIZE];
data/shadowsocks-libev-3.3.5+ds/src/manager.c:717: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, "stat: {");
data/shadowsocks-libev-3.3.5+ds/src/manager.c:753:5:  [2] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused). Risk is low because the source is a constant string.
    strcpy(buf, "err");
data/shadowsocks-libev-3.3.5+ds/src/manager.c:876: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 *server_host[MAX_REMOTE_NUM];
data/shadowsocks-libev-3.3.5+ds/src/manager.c:926: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).
            mtu = atoi(optarg);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:987: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).
            nofile = atoi(optarg);
data/shadowsocks-libev-3.3.5+ds/src/manager.h:69: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 port[8];
data/shadowsocks-libev-3.3.5+ds/src/manager.h:70: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 password[128];
data/shadowsocks-libev-3.3.5+ds/src/manager.h:71: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 fast_open[8];
data/shadowsocks-libev-3.3.5+ds/src/manager.h:72: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 no_delay[8];
data/shadowsocks-libev-3.3.5+ds/src/netutils.c:140:40:  [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).
                addr->sin_port = htons(atoi(port));
data/shadowsocks-libev-3.3.5+ds/src/netutils.c:147:41:  [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).
                addr->sin6_port = htons(atoi(port));
data/shadowsocks-libev-3.3.5+ds/src/netutils.c:174: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(storage, rp->ai_addr, sizeof(struct sockaddr_in));
data/shadowsocks-libev-3.3.5+ds/src/netutils.c:176: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(storage, rp->ai_addr, sizeof(struct sockaddr_in6));
data/shadowsocks-libev-3.3.5+ds/src/netutils.c:183: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(storage, rp->ai_addr, sizeof(struct sockaddr_in));
data/shadowsocks-libev-3.3.5+ds/src/netutils.c:185: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(storage, rp->ai_addr, sizeof(struct sockaddr_in6));
data/shadowsocks-libev-3.3.5+ds/src/plugin.c:272: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 cwd[PATH_MAX];
data/shadowsocks-libev-3.3.5+ds/src/redir.c:251: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 ipstr[INET6_ADDRSTRLEN];
data/shadowsocks-libev-3.3.5+ds/src/redir.c:487: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(abuf->data + abuf->len,
data/shadowsocks-libev-3.3.5+ds/src/redir.c:491: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(abuf->data + abuf->len,
data/shadowsocks-libev-3.3.5+ds/src/redir.c:498: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(abuf->data + abuf->len,
data/shadowsocks-libev-3.3.5+ds/src/redir.c:501: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(abuf->data + abuf->len,
data/shadowsocks-libev-3.3.5+ds/src/redir.c:888: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_port[8];
data/shadowsocks-libev-3.3.5+ds/src/redir.c:924: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).
            mtu = atoi(optarg);
data/shadowsocks-libev-3.3.5+ds/src/redir.c:983: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).
            nofile = atoi(optarg);
data/shadowsocks-libev-3.3.5+ds/src/redir.c:1228:26:  [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).
    listen_ctx.timeout = atoi(timeout);
data/shadowsocks-libev-3.3.5+ds/src/redir.c:1281:39:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
            listen_ctx_current      = memcpy(listen_ctx_current, &listen_ctx, sizeof(listen_ctx_t));
data/shadowsocks-libev-3.3.5+ds/src/resolv.c:277: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(&sa->sin_addr, he->h_addr_list[i], he->h_length);
data/shadowsocks-libev-3.3.5+ds/src/resolv.c:339: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(&sa->sin6_addr, he->h_addr_list[i], he->h_length);
data/shadowsocks-libev-3.3.5+ds/src/server.c:164: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 resp[SOCKET_BUF_SIZE];
data/shadowsocks-libev-3.3.5+ds/src/server.c:251: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 peer_name[INET6_ADDRSTRLEN] = { 0 };
data/shadowsocks-libev-3.3.5+ds/src/server.c:439: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 ipstr[INET6_ADDRSTRLEN];
data/shadowsocks-libev-3.3.5+ds/src/server.c:444: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(&s, res->ai_addr, sizeof(struct sockaddr_in));
data/shadowsocks-libev-3.3.5+ds/src/server.c:448: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(&s, res->ai_addr, sizeof(struct sockaddr_in6));
data/shadowsocks-libev-3.3.5+ds/src/server.c:561: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(&sa, res->ai_addr, sizeof(struct sockaddr_in));
data/shadowsocks-libev-3.3.5+ds/src/server.c:797: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 host[255] = { 0 };
data/shadowsocks-libev-3.3.5+ds/src/server.c:811: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(&addr->sin_addr, server->buf->data + offset, in_addr_len);
data/shadowsocks-libev-3.3.5+ds/src/server.c:820: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(&addr->sin_port, server->buf->data + offset, sizeof(uint16_t));
data/shadowsocks-libev-3.3.5+ds/src/server.c:830: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(host, server->buf->data + offset + 1, name_len);
data/shadowsocks-libev-3.3.5+ds/src/server.c:850: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(&addr->sin_port, server->buf->data + offset, sizeof(uint16_t));
data/shadowsocks-libev-3.3.5+ds/src/server.c:858: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(&addr->sin6_port, server->buf->data + offset, sizeof(uint16_t));
data/shadowsocks-libev-3.3.5+ds/src/server.c:878: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(&addr->sin6_addr, server->buf->data + offset, in6_addr_len);
data/shadowsocks-libev-3.3.5+ds/src/server.c:888: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(&addr->sin6_port, server->buf->data + offset, sizeof(uint16_t));
data/shadowsocks-libev-3.3.5+ds/src/server.c:936: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(remote->buf->data, server->buf->data + server->buf->idx,
data/shadowsocks-libev-3.3.5+ds/src/server.c:1091: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(remote->buf->data, server->buf->data + server->buf->idx,
data/shadowsocks-libev-3.3.5+ds/src/server.c:1497: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[1];
data/shadowsocks-libev-3.3.5+ds/src/server.c:1568: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_port[8];
data/shadowsocks-libev-3.3.5+ds/src/server.c:1618: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).
            mtu = atoi(optarg);
data/shadowsocks-libev-3.3.5+ds/src/server.c:1676: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).
            nofile = atoi(optarg);
data/shadowsocks-libev-3.3.5+ds/src/server.c:2008:35:  [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).
            listen_ctx->timeout = atoi(timeout);
data/shadowsocks-libev-3.3.5+ds/src/server.c:2040:62:  [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 err = init_udprelay(host, port, mtu, crypto, atoi(timeout), iface);
data/shadowsocks-libev-3.3.5+ds/src/server.h: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 hostname[MAX_HOSTNAME_LEN];
data/shadowsocks-libev-3.3.5+ds/src/socks5.h:53: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 methods[0];
data/shadowsocks-libev-3.3.5+ds/src/stream.c:98:7:  [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.
const char *supported_stream_ciphers[STREAM_CIPHER_NUM] = {
data/shadowsocks-libev-3.3.5+ds/src/stream.c:122: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 *supported_stream_ciphers_mbedtls[STREAM_CIPHER_NUM] = {
data/shadowsocks-libev-3.3.5+ds/src/stream.c:288:18:  [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 key_nonce[32];
data/shadowsocks-libev-3.3.5+ds/src/stream.c:289: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(key_nonce, cipher->key, 16);
data/shadowsocks-libev-3.3.5+ds/src/stream.c:290: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(key_nonce + 16, nonce, 16);
data/shadowsocks-libev-3.3.5+ds/src/stream.c:346: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(ciphertext->data, nonce, nonce_len);
data/shadowsocks-libev-3.3.5+ds/src/stream.c:375: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(plaintext->data, ciphertext->data, nonce_len + ciphertext->len);
data/shadowsocks-libev-3.3.5+ds/src/stream.c:403: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(ciphertext->data, cipher_ctx->nonce, nonce_len);
data/shadowsocks-libev-3.3.5+ds/src/stream.c:447: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(plaintext->data, ciphertext->data, nonce_len + ciphertext->len);
data/shadowsocks-libev-3.3.5+ds/src/stream.c:472: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(nonce, ciphertext->data, nonce_len);
data/shadowsocks-libev-3.3.5+ds/src/stream.c:506: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(ciphertext->data, plaintext->data, plaintext->len);
data/shadowsocks-libev-3.3.5+ds/src/stream.c:539: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(cipher_ctx->chunk->data + cipher_ctx->chunk->len, ciphertext->data, left_len);
data/shadowsocks-libev-3.3.5+ds/src/stream.c:553: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(nonce, cipher_ctx->chunk->data, nonce_len);
data/shadowsocks-libev-3.3.5+ds/src/stream.c:616: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(ciphertext->data, plaintext->data, plaintext->len);
data/shadowsocks-libev-3.3.5+ds/src/tunnel.c:417: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(abuf->data + abuf->len, &host, host_len);
data/shadowsocks-libev-3.3.5+ds/src/tunnel.c:429: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(abuf->data + abuf->len, &host, host_len);
data/shadowsocks-libev-3.3.5+ds/src/tunnel.c:440: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(abuf->data + abuf->len, sa->host, host_len);
data/shadowsocks-libev-3.3.5+ds/src/tunnel.c:444:35:  [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).
            uint16_t port = htons(atoi(sa->port));
data/shadowsocks-libev-3.3.5+ds/src/tunnel.c:445: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(abuf->data + abuf->len, &port, 2);
data/shadowsocks-libev-3.3.5+ds/src/tunnel.c:841: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[1];
data/shadowsocks-libev-3.3.5+ds/src/tunnel.c:882: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_port[8];
data/shadowsocks-libev-3.3.5+ds/src/tunnel.c:923: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).
            mtu = atoi(optarg);
data/shadowsocks-libev-3.3.5+ds/src/tunnel.c:994: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).
            nofile = atoi(optarg);
data/shadowsocks-libev-3.3.5+ds/src/tunnel.c:1288:26:  [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).
    listen_ctx.timeout = atoi(timeout);
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:180: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(dstaddr, CMSG_DATA(cmsg), sizeof(struct sockaddr_in));
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:184: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(dstaddr, CMSG_DATA(cmsg), sizeof(struct sockaddr_in6));
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:200: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 key[HASH_KEY_LEN];
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:203: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(key, &af, sizeof(int));
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:204: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(key + sizeof(int), (const uint8_t *)addr, addr_len);
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:222: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(addr_header + addr_header_len, &addr->sin_addr, addr_len);
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:224: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(addr_header + addr_header_len, &addr->sin_port, 2);
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:231: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(addr_header + addr_header_len, &addr->sin6_addr, addr_len);
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:233: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(addr_header + addr_header_len, &addr->sin6_port, 2);
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:259: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(&addr->sin_addr, buf + offset, sizeof(struct in_addr));
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:260: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(&addr->sin_port, buf + offset + in_addr_len, sizeof(uint16_t));
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:273: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 tmp[MAX_HOSTNAME_LEN] = { 0 };
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:275: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(tmp, buf + offset + 1, name_len);
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:280: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(&addr->sin_port, buf + offset + 1 + name_len, sizeof(uint16_t));
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:285: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(&addr->sin6_port, buf + offset + 1 + name_len, sizeof(uint16_t));
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:291: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(host, buf + offset + 1, name_len);
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:302: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(&addr->sin6_addr, buf + offset, sizeof(struct in6_addr));
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:303: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(&addr->sin6_port, buf + offset + in6_addr_len, sizeof(uint16_t));
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:319: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(port, "%d", load16_be(buf + offset));
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:329: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 s[SS_ADDRSTRLEN];
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:331: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 addr[INET6_ADDRSTRLEN] = { 0 };
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:332: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 port[PORTSTRLEN]       = { 0 };
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:339: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(&sa_in, sa, sizeof(struct sockaddr_in));
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:342: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(port, "%d", p);
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:346: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(&sa_in6, sa, sizeof(struct sockaddr_in6));
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:349: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(port, "%d", p);
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:358: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(s, addr, addr_len);
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:361: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(s + addr_len + 1, port, port_len);
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:587: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(ctx->buf->data, buf, len);
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:701: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(&remote_ctx->dst_addr, addr, sizeof(struct sockaddr_in));
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:703: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(&remote_ctx->dst_addr, addr, sizeof(struct sockaddr_in6));
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:821: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 addr_header[MAX_ADDR_HEADER_SIZE];
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:827: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->data, addr_header, addr_header_len);
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:930: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 control_buffer[64] = { 0 };
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:1049: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 addr_header[MAX_ADDR_HEADER_SIZE] = { 0 };
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:1060: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->data, addr_header, addr_header_len);
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:1065: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 addr_header[MAX_ADDR_HEADER_SIZE] = { 0 };
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:1068:56:  [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).
    uint16_t port_num                      = (uint16_t)atoi(port);
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:1084: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(addr_header + addr_header_len, &host_addr, host_len);
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:1096: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(addr_header + addr_header_len, &host_addr, host_len);
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:1107: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(addr_header + addr_header_len, host, host_len);
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:1110: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(addr_header + addr_header_len, &port_net_num, 2);
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:1116: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->data, addr_header, addr_header_len);
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:1121: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 host[MAX_HOSTNAME_LEN] = { 0 };
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:1122: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 port[MAX_PORT_STR_LEN] = { 0 };
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:1160:13:  [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 src[SS_ADDRSTRLEN];
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:1161:13:  [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 dst[SS_ADDRSTRLEN];
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:1173:13:  [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 src[SS_ADDRSTRLEN];
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:1174:13:  [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 dst[SS_ADDRSTRLEN];
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:1326: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(&remote_ctx->dst_addr, &dst_addr, sizeof(struct sockaddr_storage));
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:1362: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(query_ctx->addr_header, addr_header, addr_header_len);
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:1368:34:  [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).
        resolv_start(host, htons(atoi(port)), resolv_cb, resolv_free_cb, query_ctx);
data/shadowsocks-libev-3.3.5+ds/src/udprelay.h:75: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 addr_header[MAX_ADDR_HEADER_SIZE];
data/shadowsocks-libev-3.3.5+ds/src/utils.c:79: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[INT_DIGITS + 2];
data/shadowsocks-libev-3.3.5+ds/src/utils.c:133:13:  [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];  /* variable length array */
data/shadowsocks-libev-3.3.5+ds/src/utils.c:444:22:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
        FILE *file = fopen(path, "w");
data/shadowsocks-libev-3.3.5+ds/src/utils.c:472:20:  [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 dev_null = open("/dev/null", O_WRONLY);
data/shadowsocks-libev-3.3.5+ds/src/utils.h:60:40:  [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 (ident != NULL) { logfile = fopen(ident, "w+"); } } \
data/shadowsocks-libev-3.3.5+ds/src/utils.h:71:13:  [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 timestr[20];                                                    \
data/shadowsocks-libev-3.3.5+ds/src/utils.h:81:13:  [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 timestr[20];                                    \
data/shadowsocks-libev-3.3.5+ds/src/utils.h:100: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 timestr[20];                                    \
data/shadowsocks-libev-3.3.5+ds/src/utils.h:113: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 timestr[20];                                     \
data/shadowsocks-libev-3.3.5+ds/src/utils.h:153:13:  [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 timestr[20];                                                    \
data/shadowsocks-libev-3.3.5+ds/src/utils.h:174:13:  [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 timestr[20];                                                     \
data/shadowsocks-libev-3.3.5+ds/src/winsock.c:115:12:  [2] (buffer) TCHAR:
  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 TCHAR buff[GAI_STRERROR_BUFFER_SIZE + 1];
data/shadowsocks-libev-3.3.5+ds/src/acl.c:90: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).
    end = str + strlen(str) - 1;
data/shadowsocks-libev-3.3.5+ds/src/acl.c:137: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).
            while ((strlen(buf) == 255) && (buf[254] != '\n')) {
data/shadowsocks-libev-3.3.5+ds/src/acl.c:153:23:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
            int len = strlen(buf);
data/shadowsocks-libev-3.3.5+ds/src/acl.c:164: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(line) == 0) {
data/shadowsocks-libev-3.3.5+ds/src/acl.c:269:24:  [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 host_len = strlen(host);
data/shadowsocks-libev-3.3.5+ds/src/acl.c:340:24:  [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 host_len = strlen(host);
data/shadowsocks-libev-3.3.5+ds/src/aead.c:295:51:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
                          (uint8_t *)SUBKEY_INFO, strlen(SUBKEY_INFO),
data/shadowsocks-libev-3.3.5+ds/src/android.c:68:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120). Risk is low because the source is a
  constant string.
    strncpy(addr.sun_path, "protect_path", sizeof(addr.sun_path) - 1);
data/shadowsocks-libev-3.3.5+ds/src/android.c:119:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(addr.sun_path, stat_path, sizeof(addr.sun_path) - 1);
data/shadowsocks-libev-3.3.5+ds/src/crypto.c:209: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).
    datal = strlen((const char *)pass);
data/shadowsocks-libev-3.3.5+ds/src/crypto.c:358:25:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    size_t base64_len = strlen(base64);
data/shadowsocks-libev-3.3.5+ds/src/jconf.c:74: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).
    len = strlen(str_in);
data/shadowsocks-libev-3.3.5+ds/src/jconf.c:99:46:  [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).
            addr->host = ss_strndup(str + 1, strlen(str) - 2);
data/shadowsocks-libev-3.3.5+ds/src/jconf.c:123:22:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    size_t str_len = strlen(str);
data/shadowsocks-libev-3.3.5+ds/src/jconf.c:263: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).
                if (conf.plugin && strlen(conf.plugin) == 0) {
data/shadowsocks-libev-3.3.5+ds/src/local.c:1783: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(remote_str);
data/shadowsocks-libev-3.3.5+ds/src/local.c:1786:19:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
            len = strlen(remote_str);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:103: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).
    int path_size = strlen(prefix) + strlen(server->port) + 20;
data/shadowsocks-libev-3.3.5+ds/src/manager.c:103:38:  [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 path_size = strlen(prefix) + strlen(server->port) + 20;
data/shadowsocks-libev-3.3.5+ds/src/manager.c:160:19:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        int len = strlen(cmd);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:164:19:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        int len = strlen(cmd);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:169:19:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        int len = strlen(cmd);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:174:19:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        int len = strlen(cmd);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:178:19:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        int len = strlen(cmd);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:182:19:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        int len = strlen(cmd);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:186:19:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        int len = strlen(cmd);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:190:19:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        int len = strlen(cmd);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:194:19:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        int len = strlen(cmd);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:198:19:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        int len = strlen(cmd);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:202:19:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        int len = strlen(cmd);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:206:19:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        int len = strlen(cmd);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:210:19:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        int len = strlen(cmd);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:214:19:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        int len = strlen(cmd);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:218:19:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        int len = strlen(cmd);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:277:61:  [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).
    json_value *obj        = json_parse_ex(&settings, data, strlen(data), error_buf);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:293:21:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
                    strncpy(server->port, value->u.string.ptr, 7);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:299:21:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
                    strncpy(server->password, value->u.string.ptr, 127);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:307:21:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
                    strncpy(server->fast_open, (value->u.boolean ? "true" : "false"), 8);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:311:21:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
                    strncpy(server->no_delay, (value->u.boolean ? "true" : "false"), 8);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:348: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).
    json_value *obj = json_parse_ex(&settings, data, strlen(data), error_buf);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:360:17:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
                strncpy(port, name, 7);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:520: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).
    int pid, path_size = strlen(prefix) + strlen(pid_file) + 2;
data/shadowsocks-libev-3.3.5+ds/src/manager.c:520:43:  [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 pid, path_size = strlen(prefix) + strlen(pid_file) + 2;
data/shadowsocks-libev-3.3.5+ds/src/manager.c:543: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).
    int pid, path_size = strlen(prefix) + strlen(port) + 20;
data/shadowsocks-libev-3.3.5+ds/src/manager.c:543:43:  [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 pid, path_size = strlen(prefix) + strlen(port) + 20;
data/shadowsocks-libev-3.3.5+ds/src/manager.c:652:9:  [1] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source is a constant character.
        sprintf(buf, "[");
data/shadowsocks-libev-3.3.5+ds/src/manager.c:658: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).
            size_t pos            = strlen(buf);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:659: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).
            size_t entry_len      = strlen(server->port) + strlen(server->password) + strlen(method);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:659:60:  [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 entry_len      = strlen(server->port) + strlen(server->password) + strlen(method);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:659:87:  [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 entry_len      = strlen(server->port) + strlen(server->password) + strlen(method);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:672:22:  [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 pos = strlen(buf);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:674: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).
        pos = strlen(buf);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:723: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).
            size_t pos            = strlen(buf);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:736:22:  [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 pos = strlen(buf);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:1114: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).
    if (workdir == NULL || strlen(workdir) == 0) {
data/shadowsocks-libev-3.3.5+ds/src/manager.c:1117:96:  [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 (strstr(workdir, "nologin") || strstr(workdir, "nonexistent") || workdir == NULL || strlen(workdir) == 0) {
data/shadowsocks-libev-3.3.5+ds/src/manager.c:1121: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).
        working_dir_size = strlen(workdir) + 15;
data/shadowsocks-libev-3.3.5+ds/src/manager.c:1125: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).
        working_dir_size = strlen(workdir) + 2;
data/shadowsocks-libev-3.3.5+ds/src/manager.c:1139: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).
        size_t manager_address_size = strlen(workdir) + 20;
data/shadowsocks-libev-3.3.5+ds/src/manager.c:1193: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 len = strlen(ep->d_name);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:1212:13:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
            strncpy(server->port, conf->port_password[i].port, 7);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:1213:13:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
            strncpy(server->password, conf->port_password[i].password, 127);
data/shadowsocks-libev-3.3.5+ds/src/manager.c:1240:9:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
        strncpy(svaddr.sun_path, manager_address, sizeof(svaddr.sun_path) - 1);
data/shadowsocks-libev-3.3.5+ds/src/netutils.c:80:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(interface.ifr_name, interface_name, IFNAMSIZ - 1);
data/shadowsocks-libev-3.3.5+ds/src/plugin.c:188: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).
    buf_size = 20 + strlen(plugin) + strlen(remote_host)
data/shadowsocks-libev-3.3.5+ds/src/plugin.c:188:38:  [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).
    buf_size = 20 + strlen(plugin) + strlen(remote_host)
data/shadowsocks-libev-3.3.5+ds/src/plugin.c:189: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).
               + strlen(remote_port) + strlen(local_host) + strlen(local_port);
data/shadowsocks-libev-3.3.5+ds/src/plugin.c:189:40:  [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).
               + strlen(remote_port) + strlen(local_host) + strlen(local_port);
data/shadowsocks-libev-3.3.5+ds/src/plugin.c:189:61:  [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).
               + strlen(remote_port) + strlen(local_host) + strlen(local_port);
data/shadowsocks-libev-3.3.5+ds/src/plugin.c:258:9:  [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) == 0)
data/shadowsocks-libev-3.3.5+ds/src/plugin.c:275: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).
            new_path_len = strlen(current_path) + strlen(cwd) + 2;
data/shadowsocks-libev-3.3.5+ds/src/plugin.c:275:51:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
            new_path_len = strlen(current_path) + strlen(cwd) + 2;
data/shadowsocks-libev-3.3.5+ds/src/plugin.c:289:39:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    if (!strncmp(plugin, "obfsproxy", strlen("obfsproxy")))
data/shadowsocks-libev-3.3.5+ds/src/redir.c:1178:19:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
            len = strlen(remote_str);
data/shadowsocks-libev-3.3.5+ds/src/resolv.c:463:45:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
resolv_sock_state_cb(void *data, int s, int read, int write)
data/shadowsocks-libev-3.3.5+ds/src/resolv.c:466:31:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    int events             = (read ? EV_READ : 0) | (write ? EV_WRITE : 0);
data/shadowsocks-libev-3.3.5+ds/src/server.c:171: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).
    msgLen = strlen(resp) + 1;
data/shadowsocks-libev-3.3.5+ds/src/server.c:197:9:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
        strncpy(svaddr.sun_path, manager_addr, sizeof(svaddr.sun_path) - 1);
data/shadowsocks-libev-3.3.5+ds/src/server.c:199:31:  [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 (sendto(sfd, resp, strlen(resp) + 1, 0, (struct sockaddr *)&svaddr,
data/shadowsocks-libev-3.3.5+ds/src/server.c:223:31:  [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 (sendto(sfd, resp, strlen(resp) + 1, 0, (struct sockaddr *)&storage,
data/shadowsocks-libev-3.3.5+ds/src/server.c:1956: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(server_str);
data/shadowsocks-libev-3.3.5+ds/src/server.c:1959:19:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
            len = strlen(server_str);
data/shadowsocks-libev-3.3.5+ds/src/tunnel.c:436:32:  [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 host_len = strlen(sa->host);
data/shadowsocks-libev-3.3.5+ds/src/tunnel.c:1229:19:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
            len = strlen(remote_str);
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:353:9:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120). Risk is low because the source is a
  constant string.
        strncpy(s, "Unknown AF", SS_ADDRSTRLEN);
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:356:20:  [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 addr_len = strlen(addr);
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:357:20:  [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 port_len = strlen(port);
data/shadowsocks-libev-3.3.5+ds/src/udprelay.c:1103:24:  [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 host_len = strlen(host);
data/shadowsocks-libev-3.3.5+ds/src/uthash.h:91: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).
#define uthash_strlen(s) strlen(s)
data/shadowsocks-libev-3.3.5+ds/src/utils.c:217: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).
    size_t len = strlen(s);
data/shadowsocks-libev-3.3.5+ds/src/utils.c:225:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(ret, s, n);
data/shadowsocks-libev-3.3.5+ds/src/utils.c:455:5:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
    umask(0);
data/shadowsocks-libev-3.3.5+ds/src/utils.c:534:29:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
            buf_size = 50 + strlen(getenv("HOME"));
data/shadowsocks-libev-3.3.5+ds/src/utils.c:541:29:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
            buf_size = 50 + strlen(conf_home);
data/shadowsocks-libev-3.3.5+ds/src/winsock.c:103:23:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        ssize_t len = strlen(msg) - 1;

ANALYSIS SUMMARY:

Hits = 333
Lines analyzed = 18099 in approximately 0.45 seconds (40446 lines/second)
Physical Source Lines of Code (SLOC) = 13955
Hits@level = [0] 153 [1]  95 [2] 209 [3]  14 [4]  15 [5]   0
Hits@level+ = [0+] 486 [1+] 333 [2+] 238 [3+]  29 [4+]  15 [5+]   0
Hits/KSLOC@level+ = [0+] 34.8262 [1+] 23.8624 [2+] 17.0548 [3+] 2.07811 [4+] 1.07488 [5+]   0
Dot directories skipped = 3 (--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.