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/sockperf-3.6/src/aopt.cpp Examining data/sockperf-3.6/src/aopt.h Examining data/sockperf-3.6/src/client.cpp Examining data/sockperf-3.6/src/client.h Examining data/sockperf-3.6/src/clock.h Examining data/sockperf-3.6/src/common.cpp Examining data/sockperf-3.6/src/common.h Examining data/sockperf-3.6/src/defs.cpp Examining data/sockperf-3.6/src/defs.h Examining data/sockperf-3.6/src/iohandlers.cpp Examining data/sockperf-3.6/src/iohandlers.h Examining data/sockperf-3.6/src/message.cpp Examining data/sockperf-3.6/src/message.h Examining data/sockperf-3.6/src/os_abstract.cpp Examining data/sockperf-3.6/src/os_abstract.h Examining data/sockperf-3.6/src/packet.cpp Examining data/sockperf-3.6/src/packet.h Examining data/sockperf-3.6/src/playback.cpp Examining data/sockperf-3.6/src/playback.h Examining data/sockperf-3.6/src/server.cpp Examining data/sockperf-3.6/src/server.h Examining data/sockperf-3.6/src/ticks.cpp Examining data/sockperf-3.6/src/ticks.h Examining data/sockperf-3.6/src/vma-redirect.cpp Examining data/sockperf-3.6/src/vma-redirect.h Examining data/sockperf-3.6/src/sockperf.cpp Examining data/sockperf-3.6/src/switches.h Examining data/sockperf-3.6/src/ticks_os.h FINAL RESULTS: data/sockperf-3.6/src/aopt.cpp:40: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. #ifndef snprintf data/sockperf-3.6/src/aopt.cpp:41: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. #define snprintf _snprintf data/sockperf-3.6/src/aopt.cpp:41:18: [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. #define snprintf _snprintf data/sockperf-3.6/src/aopt.cpp:46:30: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define AOPT_TRACE(fmt, ...) printf(fmt, ##__VA_ARGS__) data/sockperf-3.6/src/aopt.cpp:345:23: [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. ret = snprintf((buf_short + cur_len_short), sizeof(buf_short) - cur_len_short, data/sockperf-3.6/src/aopt.cpp:363:23: [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. ret = snprintf((buf_long + cur_len_long), sizeof(buf_long) - cur_len_long, data/sockperf-3.6/src/aopt.cpp:380:21: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(format, " %%-7s %%-21s\n %-7s %-21s\t-%%s\n", "", ""); data/sockperf-3.6/src/aopt.cpp:382:21: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(format, " %%-7s %%-21s\t-%%s\n"); data/sockperf-3.6/src/aopt.cpp:385:23: [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. ret = snprintf((buf + buf_offset), (buf_size - buf_offset), format, buf_short, data/sockperf-3.6/src/client.cpp:604:9: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(MODULE_NAME "[CLIENT] send on:"); data/sockperf-3.6/src/defs.h:229:31: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define log_msg(log_fmt, ...) printf(MODULE_NAME ": " log_fmt "\n", ##__VA_ARGS__) data/sockperf-3.6/src/defs.h:230:42: [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 log_msg_file(file, log_fmt, ...) fprintf(file, MODULE_NAME ": " log_fmt "\n", ##__VA_ARGS__) data/sockperf-3.6/src/defs.h:242:5: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(MODULE_NAME ": " \ data/sockperf-3.6/src/defs.h:248:9: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(MODULE_NAME ": " log_fmt "\n", ##__VA_ARGS__); \ data/sockperf-3.6/src/defs.h:332:13: [4] (format) vsnprintf: 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. n = vsnprintf(buf, sizeof(buf) - 1, format, va); data/sockperf-3.6/src/server.cpp:123:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(to_array, "%s", inet_ntoa(g_pApp->m_const_params.tx_mc_if_addr)); data/sockperf-3.6/src/server.cpp:124:13: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(MODULE_NAME ": [BRIDGE] transferring messages from %s to %s on:", data/sockperf-3.6/src/server.cpp:127:13: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(MODULE_NAME ": [SERVER] listen on:"); data/sockperf-3.6/src/sockperf.cpp:321:5: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(MODULE_NAME " is a tool for testing network latency and throughput.\n"); data/sockperf-3.6/src/sockperf.cpp:349:5: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(MODULE_NAME ", version %s\n", VERSION); data/sockperf-3.6/src/sockperf.cpp:1437:17: [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(s_user_params.threads_affinity, optarg); data/sockperf-3.6/src/sockperf.cpp:1970:17: [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(s_user_params.sender_affinity, optarg); data/sockperf-3.6/src/sockperf.cpp:1980:17: [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(s_user_params.receiver_affinity, optarg); data/sockperf-3.6/src/sockperf.cpp:3422:9: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(MODULE_NAME data/sockperf-3.6/src/sockperf.cpp:3428:9: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(MODULE_NAME ": test failed because of an unknown exception \n"); data/sockperf-3.6/src/switches.h:270:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(ip_port_str, "[%s:%d]", inet_ntoa(p_clt_session->addr.sin_addr), data/sockperf-3.6/src/switches.h:291:17: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(ip_port_str, "[%s:%d]", inet_ntoa(seq_num_map_itr->second.addr.sin_addr), data/sockperf-3.6/src/switches.h:310:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(ip_port_str, "[%s:%d]", inet_ntoa(p_clt_session->addr.sin_addr), data/sockperf-3.6/src/ticks_os.h:62: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. #define snprintf _snprintf data/sockperf-3.6/src/ticks_os.h:62:18: [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. #define snprintf _snprintf data/sockperf-3.6/src/sockperf.cpp:3407:24: [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. if ((env_ptr = getenv("SEED")) != NULL) { data/sockperf-3.6/src/sockperf.cpp:3409:13: [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(seed); data/sockperf-3.6/src/vma-redirect.cpp:87:32: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *const CB_STR = getenv(VMA_LOG_CB_ENV_VAR); data/sockperf-3.6/src/aopt.cpp:330: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_short[10]; data/sockperf-3.6/src/aopt.cpp:331: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_long[50]; data/sockperf-3.6/src/aopt.cpp:377: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 format[50]; data/sockperf-3.6/src/aopt.cpp:403: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(buf, buf_temp, buf_offset); data/sockperf-3.6/src/aopt.h:77: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 shorts[AOPT_MAX_NUMBER]; /**< short name */ data/sockperf-3.6/src/aopt.h:78: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 *const longs[AOPT_MAX_NUMBER]; /**< long name */ data/sockperf-3.6/src/common.cpp:190: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. static const char *s_fds_handle_desc[FD_HANDLE_MAX] = { "recvfrom", "recvfrom", "select" data/sockperf-3.6/src/common.cpp:206:18: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE *file = fopen(path, "r"); data/sockperf-3.6/src/common.h: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(buf + (nbytes - remain_buffer), &z_ptr->m_pkt_buf[fd], data_to_copy); data/sockperf-3.6/src/defs.h:327: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[250]; data/sockperf-3.6/src/defs.h:635: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 threads_affinity[MAX_ARGV_SIZE]; data/sockperf-3.6/src/defs.h:654: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 sender_affinity[MAX_ARGV_SIZE]; data/sockperf-3.6/src/defs.h:655: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 receiver_affinity[MAX_ARGV_SIZE]; data/sockperf-3.6/src/defs.h:668: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 feedfile_name[MAX_PATH_LENGTH]; data/sockperf-3.6/src/iohandlers.h:213: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(mp_timeout_timeval, g_pApp->m_const_params.select_timeout, data/sockperf-3.6/src/iohandlers.h:216: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(&m_readfds, &m_save_fds, sizeof(fd_set)); data/sockperf-3.6/src/message.cpp:55: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[LEN + 1]; data/sockperf-3.6/src/server.cpp:84: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(&bind_addr, p_bind_addr, sizeof(struct sockaddr_in)); data/sockperf-3.6/src/server.cpp:122: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 to_array[20]; data/sockperf-3.6/src/server.cpp:254: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, g_fds_array[ifd], sizeof(struct fds_data)); data/sockperf-3.6/src/server.cpp:634: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(&new_session.addr, clt_addr, sizeof(struct sockaddr_in)); data/sockperf-3.6/src/sockperf.cpp:131: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 *const shorts[4]; /* short name */ data/sockperf-3.6/src/sockperf.cpp:331: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_buf[21]; data/sockperf-3.6/src/sockperf.cpp:604: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 temp_buf[30]; data/sockperf-3.6/src/sockperf.cpp:878: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 temp_buf[30]; data/sockperf-3.6/src/sockperf.cpp:1146: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 temp_buf[30]; data/sockperf-3.6/src/sockperf.cpp:1288: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 temp_buf[30]; data/sockperf-3.6/src/sockperf.cpp:1480: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 temp_buf[30]; data/sockperf-3.6/src/sockperf.cpp:1545: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(&p_addr->sin_addr, hostip->h_addr_list[0], hostip->h_length); data/sockperf-3.6/src/sockperf.cpp:1600: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. char fd_handle_type[MAX_ARGV_SIZE]; data/sockperf-3.6/src/sockperf.cpp:1695: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(&(s_user_params.mc_source_ip_addr), hostip->h_addr_list[0], data/sockperf-3.6/src/sockperf.cpp:1991:45: [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). s_user_params.fileFullLog = fopen(optarg, "w"); data/sockperf-3.6/src/sockperf.cpp:2310: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(start_addrs, iov[index].iov_base, iov[index].iov_len); data/sockperf-3.6/src/sockperf.cpp:2721: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 line[MAX_MCFILE_LINE_LENGTH]; data/sockperf-3.6/src/sockperf.cpp:2747:20: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((file_fd = fopen(feedfile_name, "r")) == NULL) { data/sockperf-3.6/src/sockperf.cpp:2830:47: [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). tmp->server_addr.sin_port = htons(atoi(port)); data/sockperf-3.6/src/sockperf.cpp:2835: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(&(tmp->server_addr.sin_addr), hostip->h_addr_list[0], hostip->h_length); data/sockperf-3.6/src/sockperf.cpp:2846: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(&(tmp->mc_source_ip_addr), hostip->h_addr_list[0], hostip->h_length); data/sockperf-3.6/src/sockperf.cpp:2993:47: [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). tmp->server_addr.sin_port = htons(atoi(port)); data/sockperf-3.6/src/sockperf.cpp:3005:47: [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). tmp->server_addr.sin_port = htons(atoi(port)); data/sockperf-3.6/src/sockperf.cpp:3089: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->server_addr, &(s_user_params.addr), sizeof(struct sockaddr_in)); data/sockperf-3.6/src/sockperf.cpp:3408: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). int seed = (unsigned)atoi(env_ptr); data/sockperf-3.6/src/switches.h:267: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 ip_port_str[30]; data/sockperf-3.6/src/switches.h:288: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 drops_num_str[23]; data/sockperf-3.6/src/switches.h:289: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 seq_num_info_str[50]; data/sockperf-3.6/src/switches.h:290: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 ip_port_str[30]; data/sockperf-3.6/src/switches.h:293:17: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(drops_num_str, "(%" PRIu64 ")", drops_num); data/sockperf-3.6/src/switches.h:294:17: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(seq_num_info_str, "[%" PRIu64 " - %" PRIu64 "]", data/sockperf-3.6/src/switches.h:309: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 ip_port_str[30]; data/sockperf-3.6/src/ticks.cpp:138: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[LEN + 1]; data/sockperf-3.6/src/vma-redirect.cpp:96: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 str[64]; data/sockperf-3.6/src/vma-redirect.cpp:97: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(str, "%p", log_cb); data/sockperf-3.6/src/vma-redirect.cpp:158:38: [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 (!SET_FUNC_POINTER(libHandle, open)) ret = false; data/sockperf-3.6/src/vma-redirect.cpp:165:38: [2] (race) vfork: On some old systems, vfork() permits race conditions, and it's very difficult to use correctly (CWE-362). Use fork() instead. if (!SET_FUNC_POINTER(libHandle, vfork)) ret = false; data/sockperf-3.6/src/vma-redirect.h:264:9: [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). #define open(...) fn_open(__VA_ARGS__) data/sockperf-3.6/src/vma-redirect.h:271:9: [2] (race) vfork: On some old systems, vfork() permits race conditions, and it's very difficult to use correctly (CWE-362). Use fork() instead. #define vfork(...) fn_vfork(__VA_ARGS__) data/sockperf-3.6/src/aopt.cpp:122:68: [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(token_opt, desc_long, strlen(desc_long))) { data/sockperf-3.6/src/aopt.cpp:123:52: [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 (!token_opt[strlen(desc_long)] || data/sockperf-3.6/src/aopt.cpp:124:52: [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). (token_opt[strlen(desc_long)] == '=')) { data/sockperf-3.6/src/aopt.cpp:125:65: [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). token_arg = token_opt + strlen(desc_long); data/sockperf-3.6/src/aopt.cpp:379:21: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen(buf_long) > 21) { data/sockperf-3.6/src/client.cpp:420:5: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(100 * 1000); // 0.1 sec - wait for rx packets for last sends (in normal flow) data/sockperf-3.6/src/client.cpp:697:5: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(100 * 1000); // wait for receiver thread to start (since we don't use warmup) //TODO: data/sockperf-3.6/src/client.cpp:721:5: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(20 * 1000); // wait for reply of last packet //TODO: configure! data/sockperf-3.6/src/sockperf.cpp:1579:21: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(feedfile_name, optarg, MAX_ARGV_SIZE); data/sockperf-3.6/src/sockperf.cpp:1602:21: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(fd_handle_type, optarg, MAX_ARGV_SIZE); data/sockperf-3.6/src/sockperf.cpp:3078:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen(s_user_params.feedfile_name)) { data/sockperf-3.6/src/sockperf.cpp:3359: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). (strlen(s_user_params.sender_affinity) ? s_user_params.sender_affinity : "<empty>"), data/sockperf-3.6/src/sockperf.cpp:3360: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). (strlen(s_user_params.receiver_affinity) ? s_user_params.receiver_affinity : "<empty>"), data/sockperf-3.6/src/sockperf.cpp:3362: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). (strlen(s_user_params.feedfile_name) ? s_user_params.feedfile_name : "<empty>"), data/sockperf-3.6/src/ticks.cpp:67:9: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(100000); // 0.1 sec data/sockperf-3.6/src/ticks_os.h:61:9: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. #define usleep(x) Sleep(x / 1000) data/sockperf-3.6/src/vma-redirect.cpp:132:38: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (!SET_FUNC_POINTER(libHandle, read)) ret = false; data/sockperf-3.6/src/vma-redirect.h:238:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). #define read(...) fn_read(__VA_ARGS__) ANALYSIS SUMMARY: Hits = 107 Lines analyzed = 11424 in approximately 0.34 seconds (33737 lines/second) Physical Source Lines of Code (SLOC) = 8029 Hits@level = [0] 357 [1] 18 [2] 56 [3] 3 [4] 30 [5] 0 Hits@level+ = [0+] 464 [1+] 107 [2+] 89 [3+] 33 [4+] 30 [5+] 0 Hits/KSLOC@level+ = [0+] 57.7905 [1+] 13.3267 [2+] 11.0848 [3+] 4.1101 [4+] 3.73646 [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.