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/simple-obfs-0.0.5/src/android.c Examining data/simple-obfs-0.0.5/src/base64.c Examining data/simple-obfs-0.0.5/src/base64.h Examining data/simple-obfs-0.0.5/src/common.h Examining data/simple-obfs-0.0.5/src/encrypt.c Examining data/simple-obfs-0.0.5/src/encrypt.h Examining data/simple-obfs-0.0.5/src/jconf.c Examining data/simple-obfs-0.0.5/src/jconf.h Examining data/simple-obfs-0.0.5/src/json.c Examining data/simple-obfs-0.0.5/src/json.h Examining data/simple-obfs-0.0.5/src/local.c Examining data/simple-obfs-0.0.5/src/local.h Examining data/simple-obfs-0.0.5/src/netutils.h Examining data/simple-obfs-0.0.5/src/obfs.h Examining data/simple-obfs-0.0.5/src/obfs_http.h Examining data/simple-obfs-0.0.5/src/obfs_tls.c Examining data/simple-obfs-0.0.5/src/obfs_tls.h Examining data/simple-obfs-0.0.5/src/options.c Examining data/simple-obfs-0.0.5/src/options.h Examining data/simple-obfs-0.0.5/src/server.c Examining data/simple-obfs-0.0.5/src/server.h Examining data/simple-obfs-0.0.5/src/uthash.h Examining data/simple-obfs-0.0.5/src/utils.c Examining data/simple-obfs-0.0.5/src/utils.h Examining data/simple-obfs-0.0.5/src/win32.c Examining data/simple-obfs-0.0.5/src/win32.h Examining data/simple-obfs-0.0.5/src/netutils.c Examining data/simple-obfs-0.0.5/src/obfs_http.c FINAL RESULTS: data/simple-obfs-0.0.5/src/json.c:928:10: [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 (error_buf, error); data/simple-obfs-0.0.5/src/obfs_http.c:106:9: [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(http_header, sizeof(http_header), http_request_template, data/simple-obfs-0.0.5/src/obfs_http.c:149:9: [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(http_header, sizeof(http_header), http_response_template, data/simple-obfs-0.0.5/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/simple-obfs-0.0.5/src/utils.h:160: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/simple-obfs-0.0.5/src/utils.h:179: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/simple-obfs-0.0.5/src/local.c:883: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/simple-obfs-0.0.5/src/local.c:889:28: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *ss_remote_host = getenv("SS_REMOTE_HOST"); data/simple-obfs-0.0.5/src/local.c:890:28: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *ss_remote_port = getenv("SS_REMOTE_PORT"); data/simple-obfs-0.0.5/src/local.c:891:28: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *ss_local_host = getenv("SS_LOCAL_HOST"); data/simple-obfs-0.0.5/src/local.c:892:28: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *ss_local_port = getenv("SS_LOCAL_PORT"); data/simple-obfs-0.0.5/src/local.c:893:28: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *ss_plugin_opts = getenv("SS_PLUGIN_OPTIONS"); data/simple-obfs-0.0.5/src/local.c:991: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:t:i:c:b:a:n:hvV6", data/simple-obfs-0.0.5/src/local.c:994: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:t:i:c:b:a:n:hv6", data/simple-obfs-0.0.5/src/server.c:1095:28: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *ss_remote_host = getenv("SS_REMOTE_HOST"); data/simple-obfs-0.0.5/src/server.c:1096:28: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *ss_remote_port = getenv("SS_REMOTE_PORT"); data/simple-obfs-0.0.5/src/server.c:1097:28: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *ss_local_host = getenv("SS_LOCAL_HOST"); data/simple-obfs-0.0.5/src/server.c:1098:28: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *ss_local_port = getenv("SS_LOCAL_PORT"); data/simple-obfs-0.0.5/src/server.c:1099:28: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *ss_plugin_opts = getenv("SS_PLUGIN_OPTIONS"); data/simple-obfs-0.0.5/src/server.c:1200: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:t:b:c:i:d:r:a:n:hv6", data/simple-obfs-0.0.5/src/jconf.c:117: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/simple-obfs-0.0.5/src/jconf.c:144: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/simple-obfs-0.0.5/src/json.c:247:4: [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 (&state.settings, settings, sizeof (json_settings)); data/simple-obfs-0.0.5/src/json.c:280:16: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. { sprintf (error, "Unexpected EOF in string (at %d:%d)", line_and_col); data/simple-obfs-0.0.5/src/json.c:306:25: [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 (error, "Invalid character value `%c` (at %d:%d)", b, line_and_col); data/simple-obfs-0.0.5/src/json.c:323:29: [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 (error, "Invalid character value `%c` (at %d:%d)", b, line_and_col); data/simple-obfs-0.0.5/src/json.c:452:22: [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 (error, "%d:%d: Unexpected EOF in block comment", line_and_col); data/simple-obfs-0.0.5/src/json.c:468:19: [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 (error, "%d:%d: Comment not allowed here", line_and_col); data/simple-obfs-0.0.5/src/json.c:473:19: [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 (error, "%d:%d: EOF unexpected", line_and_col); data/simple-obfs-0.0.5/src/json.c:488:22: [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 (error, "%d:%d: Unexpected `%c` in comment opening sequence", line_and_col, b); data/simple-obfs-0.0.5/src/json.c:506:19: [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 (error, "%d:%d: Trailing garbage: `%c`", data/simple-obfs-0.0.5/src/json.c:525:22: [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 (error, "%d:%d: Unexpected ]", line_and_col); data/simple-obfs-0.0.5/src/json.c:541:25: [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 (error, "%d:%d: Expected , before %c", data/simple-obfs-0.0.5/src/json.c:556:25: [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 (error, "%d:%d: Expected : before %c", data/simple-obfs-0.0.5/src/json.c:682:28: [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 (error, "%d:%d: Unexpected %c when seeking value", line_and_col, b); data/simple-obfs-0.0.5/src/json.c:702:25: [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 (error, "%d:%d: Expected , before \"", line_and_col); data/simple-obfs-0.0.5/src/json.c:727:22: [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 (error, "%d:%d: Unexpected `%c` in object", line_and_col, b); data/simple-obfs-0.0.5/src/json.c:745:28: [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 (error, "%d:%d: Unexpected `0` before `%c`", line_and_col, b); data/simple-obfs-0.0.5/src/json.c:782:22: [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 (error, "%d:%d: Expected digit before `.`", line_and_col); data/simple-obfs-0.0.5/src/json.c:798:25: [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 (error, "%d:%d: Expected digit after `.`", line_and_col); data/simple-obfs-0.0.5/src/json.c:824:22: [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 (error, "%d:%d: Expected digit after `e`", line_and_col); data/simple-obfs-0.0.5/src/json.c:910:4: [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 (error, "%d:%d: Unknown value", line_and_col); data/simple-obfs-0.0.5/src/json.c:915:4: [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 (error, "Memory allocation failure"); data/simple-obfs-0.0.5/src/json.c:920:4: [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 (error, "%d:%d: Too long (caught overflow)", line_and_col); data/simple-obfs-0.0.5/src/json.c:930:10: [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 (error_buf, "Unknown error"); data/simple-obfs-0.0.5/src/local.c:451: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, buf->data, buf->len); data/simple-obfs-0.0.5/src/local.c:825: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/simple-obfs-0.0.5/src/local.c:1049: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/simple-obfs-0.0.5/src/local.c:1176:27: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). obfs_para->port = atoi(remote_port); data/simple-obfs-0.0.5/src/local.c:1206: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/simple-obfs-0.0.5/src/netutils.c:132: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/simple-obfs-0.0.5/src/netutils.c:139: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/simple-obfs-0.0.5/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_in)); data/simple-obfs-0.0.5/src/netutils.c:178: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/simple-obfs-0.0.5/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_in)); data/simple-obfs-0.0.5/src/netutils.c:187: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/simple-obfs-0.0.5/src/obfs_http.c:92:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char host_port[256]; data/simple-obfs-0.0.5/src/obfs_http.c:93:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char http_header[512]; data/simple-obfs-0.0.5/src/obfs_http.c:95: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 b64[64]; data/simple-obfs-0.0.5/src/obfs_http.c:113: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, http_header, obfs_len); data/simple-obfs-0.0.5/src/obfs_http.c:132: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 http_header[512]; data/simple-obfs-0.0.5/src/obfs_http.c:133: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 datetime[64]; data/simple-obfs-0.0.5/src/obfs_http.c:135: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 b64[64]; data/simple-obfs-0.0.5/src/obfs_http.c:155: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, http_header, obfs_len); data/simple-obfs-0.0.5/src/obfs_tls.c:165: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 tls_data_header[3] = {0x17, 0x03, 0x03}; data/simple-obfs-0.0.5/src/obfs_tls.c:200: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, tls_data_header, 3); data/simple-obfs-0.0.5/src/obfs_tls.c:221: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(frame->buf + frame->idx - 3, buf->data + bidx, 1); data/simple-obfs-0.0.5/src/obfs_tls.c:279:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(tmp.data, buf->data, buf_len); data/simple-obfs-0.0.5/src/obfs_tls.c:283: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(hello, &tls_client_hello_template, hello_len); data/simple-obfs-0.0.5/src/obfs_tls.c:294: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(ticket, &tls_ext_session_ticket_template, sizeof(struct tls_ext_session_ticket)); data/simple-obfs-0.0.5/src/obfs_tls.c:296: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((char *)ticket + ticket_len, tmp.data, buf_len); data/simple-obfs-0.0.5/src/obfs_tls.c:301: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(server_name, &tls_ext_server_name_template, server_name_len); data/simple-obfs-0.0.5/src/obfs_tls.c:305: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((char *)server_name + server_name_len, obfs_tls->host, host_len); data/simple-obfs-0.0.5/src/obfs_tls.c:308: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((char *)server_name + server_name_len + host_len, &tls_ext_others_template, data/simple-obfs-0.0.5/src/obfs_tls.c:342:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(tmp.data, buf->data, buf_len); data/simple-obfs-0.0.5/src/obfs_tls.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(buf->data, &tls_server_hello_template, hello_len); data/simple-obfs-0.0.5/src/obfs_tls.c:350: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(hello->session_id, obfs->buf->data, 32); data/simple-obfs-0.0.5/src/obfs_tls.c:356:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf->data + hello_len, &tls_change_cipher_spec_template, change_cipher_spec_len); data/simple-obfs-0.0.5/src/obfs_tls.c:359:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf->data + hello_len + change_cipher_spec_len, &tls_encrypted_handshake_template, data/simple-obfs-0.0.5/src/obfs_tls.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(buf->data + hello_len + change_cipher_spec_len + encrypted_handshake_len, data/simple-obfs-0.0.5/src/obfs_tls.c:410: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(obfs->buf->data, hello->session_id, 32); data/simple-obfs-0.0.5/src/obfs_tls.h:39: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 random_bytes[28]; data/simple-obfs-0.0.5/src/obfs_tls.h:41: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 session_id[32]; data/simple-obfs-0.0.5/src/obfs_tls.h:43: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 cipher_suites[56]; data/simple-obfs-0.0.5/src/obfs_tls.h:45: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 comp_methods[1]; data/simple-obfs-0.0.5/src/obfs_tls.h:68: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 ec_point_formats[3]; data/simple-obfs-0.0.5/src/obfs_tls.h:73: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 elliptic_curves[8]; data/simple-obfs-0.0.5/src/obfs_tls.h:78: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 sig_algos[30]; data/simple-obfs-0.0.5/src/obfs_tls.h:98: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 random_bytes[28]; data/simple-obfs-0.0.5/src/obfs_tls.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 session_id[32]; data/simple-obfs-0.0.5/src/obfs_tls.h:115: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 ec_point_formats[1]; data/simple-obfs-0.0.5/src/obfs_tls.h:135: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[2]; data/simple-obfs-0.0.5/src/options.h:29: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 *keys[MAX_OPTION_NUM]; data/simple-obfs-0.0.5/src/options.h:30: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 *values[MAX_OPTION_NUM]; data/simple-obfs-0.0.5/src/server.c:399: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(server->buf->data, server->header_buf->data, server->header_buf->len); data/simple-obfs-0.0.5/src/server.c:410:37: [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((uint16_t)atoi(server->listen_ctx->dst_addr->port)); data/simple-obfs-0.0.5/src/server.c:417:36: [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 = htons((uint16_t)atoi(server->listen_ctx->failover->port)); data/simple-obfs-0.0.5/src/server.c:440: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 tmp_port[16]; data/simple-obfs-0.0.5/src/server.c:482: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(remote->buf->data, server->buf->data, server->buf->len); data/simple-obfs-0.0.5/src/server.c:572: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(server->header_buf->data, server->buf->data + server->buf->idx, server->header_buf->len); data/simple-obfs-0.0.5/src/server.c:1085:11: [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 *server_host[MAX_REMOTE_NUM]; data/simple-obfs-0.0.5/src/server.c:1261: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/simple-obfs-0.0.5/src/server.c:1450:31: [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/simple-obfs-0.0.5/src/utils.c:73: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/simple-obfs-0.0.5/src/utils.c:126: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/simple-obfs-0.0.5/src/utils.c:337: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/simple-obfs-0.0.5/src/utils.h:79: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/simple-obfs-0.0.5/src/utils.h:91: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/simple-obfs-0.0.5/src/utils.h:102: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/simple-obfs-0.0.5/src/utils.h:121: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/simple-obfs-0.0.5/src/utils.h:130: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/simple-obfs-0.0.5/src/utils.h:163: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/simple-obfs-0.0.5/src/utils.h:182: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/simple-obfs-0.0.5/src/win32.c:157: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, tmp, NS_INADDRSZ); data/simple-obfs-0.0.5/src/win32.c:254: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, tmp, NS_IN6ADDRSZ); data/simple-obfs-0.0.5/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/simple-obfs-0.0.5/src/jconf.c:92: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/simple-obfs-0.0.5/src/local.c:921: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). strlen(ss_plugin_opts), &opts); data/simple-obfs-0.0.5/src/local.c:926:30: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t key_len = strlen(key); data/simple-obfs-0.0.5/src/netutils.c:88: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/simple-obfs-0.0.5/src/obfs_http.c:262: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). header_len = strlen(header); data/simple-obfs-0.0.5/src/obfs_http.c:275:13: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(*value, data + header_len, len - header_len); data/simple-obfs-0.0.5/src/obfs_tls.c:270:27: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t host_len = strlen(obfs_tls->host); data/simple-obfs-0.0.5/src/server.c:408: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). size_t name_len = strlen(server->listen_ctx->dst_addr->host); data/simple-obfs-0.0.5/src/server.c:415: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). name_len = strlen(server->listen_ctx->failover->host); data/simple-obfs-0.0.5/src/server.c:1126: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). strlen(ss_plugin_opts), &opts); data/simple-obfs-0.0.5/src/server.c:1131:30: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t key_len = strlen(key); data/simple-obfs-0.0.5/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/simple-obfs-0.0.5/src/utils.c:206: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/simple-obfs-0.0.5/src/utils.c:214: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/simple-obfs-0.0.5/src/utils.c:348:5: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(0); ANALYSIS SUMMARY: Hits = 131 Lines analyzed = 8717 in approximately 0.23 seconds (37947 lines/second) Physical Source Lines of Code (SLOC) = 6534 Hits@level = [0] 52 [1] 16 [2] 95 [3] 14 [4] 6 [5] 0 Hits@level+ = [0+] 183 [1+] 131 [2+] 115 [3+] 20 [4+] 6 [5+] 0 Hits/KSLOC@level+ = [0+] 28.0073 [1+] 20.049 [2+] 17.6002 [3+] 3.06091 [4+] 0.918274 [5+] 0 Dot directories skipped = 1 (--followdotdir overrides) Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code! See 'Secure Programming HOWTO' (https://dwheeler.com/secure-programs) for more information.