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/sniproxy-0.6.0/src/address.c Examining data/sniproxy-0.6.0/src/address.h Examining data/sniproxy-0.6.0/src/backend.c Examining data/sniproxy-0.6.0/src/backend.h Examining data/sniproxy-0.6.0/src/binder.c Examining data/sniproxy-0.6.0/src/binder.h Examining data/sniproxy-0.6.0/src/buffer.c Examining data/sniproxy-0.6.0/src/buffer.h Examining data/sniproxy-0.6.0/src/cfg_parser.c Examining data/sniproxy-0.6.0/src/cfg_parser.h Examining data/sniproxy-0.6.0/src/cfg_tokenizer.c Examining data/sniproxy-0.6.0/src/cfg_tokenizer.h Examining data/sniproxy-0.6.0/src/config.c Examining data/sniproxy-0.6.0/src/config.h Examining data/sniproxy-0.6.0/src/connection.c Examining data/sniproxy-0.6.0/src/connection.h Examining data/sniproxy-0.6.0/src/http.c Examining data/sniproxy-0.6.0/src/listener.c Examining data/sniproxy-0.6.0/src/listener.h Examining data/sniproxy-0.6.0/src/logger.c Examining data/sniproxy-0.6.0/src/logger.h Examining data/sniproxy-0.6.0/src/protocol.h Examining data/sniproxy-0.6.0/src/resolv.c Examining data/sniproxy-0.6.0/src/resolv.h Examining data/sniproxy-0.6.0/src/sniproxy.c Examining data/sniproxy-0.6.0/src/table.c Examining data/sniproxy-0.6.0/src/table.h Examining data/sniproxy-0.6.0/src/tls.c Examining data/sniproxy-0.6.0/src/http.h Examining data/sniproxy-0.6.0/src/tls.h Examining data/sniproxy-0.6.0/tests/address_test.c Examining data/sniproxy-0.6.0/tests/binder_test.c Examining data/sniproxy-0.6.0/tests/buffer_test.c Examining data/sniproxy-0.6.0/tests/cfg_tokenizer_test.c Examining data/sniproxy-0.6.0/tests/config_test.c Examining data/sniproxy-0.6.0/tests/http_test.c Examining data/sniproxy-0.6.0/tests/resolv_test.c Examining data/sniproxy-0.6.0/tests/table_test.c Examining data/sniproxy-0.6.0/tests/tls_test.c FINAL RESULTS: data/sniproxy-0.6.0/src/address.c:378:17: [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(buffer, buffer_len, "%s:%" PRIu16, data/sniproxy-0.6.0/src/address.c:389:17: [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(buffer, buffer_len, "*:%" PRIu16, data/sniproxy-0.6.0/src/address.c:413:17: [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(buffer, buffer_len, "%s:%" PRIu16, ip, data/sniproxy-0.6.0/src/address.c:425:17: [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(buffer, buffer_len, "[%s]:%" PRIu16, ip, data/sniproxy-0.6.0/src/connection.c:387: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. buf_len = snprintf(buf, sizeof(buf), " %" PRIu16, data/sniproxy-0.6.0/src/connection.c:392: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. buf_len = snprintf(buf, sizeof(buf), " %" PRIu16, data/sniproxy-0.6.0/src/connection.c:414: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. buf_len = snprintf(buf, sizeof(buf), " %" PRIu16, data/sniproxy-0.6.0/src/connection.c:419: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. buf_len = snprintf(buf, sizeof(buf), " %" PRIu16, data/sniproxy-0.6.0/src/logger.c:271:9: [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. vsnprintf(buffer + len, sizeof(buffer) - len, format, args); data/sniproxy-0.6.0/src/logger.h:50:29: [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. __attribute__ ((format (printf, 1, 2))) data/sniproxy-0.6.0/src/logger.h:53:29: [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. __attribute__ ((format (printf, 1, 2))); data/sniproxy-0.6.0/src/logger.h:55:29: [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. __attribute__ ((format (printf, 1, 2))); data/sniproxy-0.6.0/src/logger.h:57:29: [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. __attribute__ ((format (printf, 1, 2))); data/sniproxy-0.6.0/src/logger.h:59:29: [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. __attribute__ ((format (printf, 1, 2))); data/sniproxy-0.6.0/src/logger.h:61:29: [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. __attribute__ ((format (printf, 1, 2))); data/sniproxy-0.6.0/src/logger.h:64:29: [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. __attribute__ ((format (printf, 3, 4))); data/sniproxy-0.6.0/src/sniproxy.c:74:19: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((opt = getopt(argc, argv, "fc:n:V")) != -1) { data/sniproxy-0.6.0/src/address.c:66: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 ip_buf[ADDRESS_BUFFER_SIZE]; data/sniproxy-0.6.0/src/address.c:105:24: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). int port_num = atoi(port + 1); data/sniproxy-0.6.0/src/address.c:172: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->data, hostname_or_ip, len); data/sniproxy-0.6.0/src/address.c:194: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->data, sa, sa_len); data/sniproxy-0.6.0/src/address.c:207: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_addr, addr, len); data/sniproxy-0.6.0/src/address.c:362:16: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). int port = atoi(str); data/sniproxy-0.6.0/src/address.c:402: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 ip[INET6_ADDRSTRLEN]; data/sniproxy-0.6.0/src/backend.c:110: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 address[ADDRESS_BUFFER_SIZE]; data/sniproxy-0.6.0/src/backend.c:141: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 address[ADDRESS_BUFFER_SIZE]; data/sniproxy-0.6.0/src/binder.c:89: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_buf[64]; data/sniproxy-0.6.0/src/binder.c:90: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 data_buf[256]; data/sniproxy-0.6.0/src/binder.c:103: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(&request->address, addr, addr_len); data/sniproxy-0.6.0/src/binder.c:144: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 buffer[256]; data/sniproxy-0.6.0/src/binder.c:187: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 control_data[64]; data/sniproxy-0.6.0/src/binder.c:203: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(fdptr, &fd, sizeof(fd)); data/sniproxy-0.6.0/src/buffer.c:231: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((char *)dst + bytes_copied, iov[i].iov_base, iov[i].iov_len); data/sniproxy-0.6.0/src/buffer.c:264: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(iov[i].iov_base, (char *)src + bytes_appended, iov[i].iov_len); data/sniproxy-0.6.0/src/buffer.c:299: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. assert((char *)iov[0].iov_base >= buffer->buffer); data/sniproxy-0.6.0/src/buffer.c:300: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. assert((char *)iov[0].iov_base + iov[0].iov_len <= buffer->buffer + buffer_size(buffer)); data/sniproxy-0.6.0/src/buffer.c:311: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. assert((char *)iov[0].iov_base >= buffer->buffer); data/sniproxy-0.6.0/src/buffer.c:312: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. assert((char *)iov[0].iov_base + iov[0].iov_len <= buffer->buffer + buffer_size(buffer)); data/sniproxy-0.6.0/src/buffer.c:314: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. assert((char *)iov[1].iov_base >= buffer->buffer); data/sniproxy-0.6.0/src/buffer.c:315: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. assert((char *)iov[1].iov_base + iov[1].iov_len <= (char *)iov[0].iov_base); data/sniproxy-0.6.0/src/buffer.c:315:61: [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. assert((char *)iov[1].iov_base + iov[1].iov_len <= (char *)iov[0].iov_base); data/sniproxy-0.6.0/src/buffer.c:336: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. assert((char *)iov[0].iov_base >= buffer->buffer); data/sniproxy-0.6.0/src/buffer.c:337: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. assert((char *)iov[0].iov_base + iov[0].iov_len <= buffer->buffer + buffer_size(buffer)); data/sniproxy-0.6.0/src/buffer.c:348: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. assert((char *)iov[0].iov_base >= buffer->buffer); data/sniproxy-0.6.0/src/buffer.c:349: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. assert((char *)iov[0].iov_base + iov[0].iov_len <= buffer->buffer + buffer_size(buffer)); data/sniproxy-0.6.0/src/buffer.c:351: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. assert((char *)iov[1].iov_base >= buffer->buffer); data/sniproxy-0.6.0/src/buffer.c:352: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. assert((char *)iov[1].iov_base + iov[1].iov_len <= (char *)iov[0].iov_base); data/sniproxy-0.6.0/src/buffer.c:352:61: [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. assert((char *)iov[1].iov_base + iov[1].iov_len <= (char *)iov[0].iov_base); data/sniproxy-0.6.0/src/cfg_parser.c:37: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 buffer[256]; data/sniproxy-0.6.0/src/config.c:223: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(config->filename, "r"); data/sniproxy-0.6.0/src/config.c:232: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 line[256]; data/sniproxy-0.6.0/src/connection.c:181:14: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). int fd = mkstemp(filename); data/sniproxy-0.6.0/src/connection.c:364: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[INET6_ADDRSTRLEN] = { '\0' }; data/sniproxy-0.6.0/src/connection.c:446: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 client[INET6_ADDRSTRLEN + 8]; data/sniproxy-0.6.0/src/connection.c:525: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 listener_address[ADDRESS_BUFFER_SIZE]; data/sniproxy-0.6.0/src/connection.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(&con->server.addr, address_sa(result.address), data/sniproxy-0.6.0/src/connection.c:590: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(&con->server.addr, address_sa(result), con->server.addr_len); data/sniproxy-0.6.0/src/connection.c:616: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 client[INET6_ADDRSTRLEN + 8]; data/sniproxy-0.6.0/src/connection.c:687: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 server[INET6_ADDRSTRLEN + 8]; data/sniproxy-0.6.0/src/connection.c:832: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 client_address[ADDRESS_BUFFER_SIZE]; data/sniproxy-0.6.0/src/connection.c:833: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 listener_address[ADDRESS_BUFFER_SIZE]; data/sniproxy-0.6.0/src/connection.c:834: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_address[ADDRESS_BUFFER_SIZE]; data/sniproxy-0.6.0/src/connection.c:905: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 client[INET6_ADDRSTRLEN + 8]; data/sniproxy-0.6.0/src/connection.c:906: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[INET6_ADDRSTRLEN + 8]; data/sniproxy-0.6.0/src/listener.c:94: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 address[ADDRESS_BUFFER_SIZE]; data/sniproxy-0.6.0/src/listener.c:114: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 address[ADDRESS_BUFFER_SIZE]; data/sniproxy-0.6.0/src/listener.c:401: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 address[ADDRESS_BUFFER_SIZE]; data/sniproxy-0.6.0/src/listener.c:496: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 address[ADDRESS_BUFFER_SIZE]; data/sniproxy-0.6.0/src/listener.c:685: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 address[ADDRESS_BUFFER_SIZE]; data/sniproxy-0.6.0/src/listener.c:793: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 address_buf[ADDRESS_BUFFER_SIZE]; data/sniproxy-0.6.0/src/logger.c:266: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 buffer[1024]; data/sniproxy-0.6.0/src/logger.c:405:16: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE *fd = fopen(filepath, "a"); data/sniproxy-0.6.0/src/logger.c:479: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 string[32]; data/sniproxy-0.6.0/src/sniproxy.c:263:16: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE *fp = fopen(path, "w"); data/sniproxy-0.6.0/tests/address_test.c:69: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 buffer[255]; data/sniproxy-0.6.0/tests/buffer_test.c:12: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 output[sizeof(input)]; data/sniproxy-0.6.0/tests/buffer_test.c:51: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 output[sizeof(input)]; data/sniproxy-0.6.0/tests/buffer_test.c:100:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char output[sizeof(input)]; data/sniproxy-0.6.0/tests/buffer_test.c:132: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). read_fd = open("/dev/zero", O_RDONLY); data/sniproxy-0.6.0/tests/buffer_test.c:138:16: [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). write_fd = open("/dev/null", O_WRONLY); data/sniproxy-0.6.0/tests/buffer_test.c:155: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 output[sizeof(input)]; data/sniproxy-0.6.0/tests/cfg_tokenizer_test.c:49: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 buffer[256]; data/sniproxy-0.6.0/tests/cfg_tokenizer_test.c:54:11: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). cfg = tmpfile(); data/sniproxy-0.6.0/tests/resolv_test.c:13: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 ip_buf[INET6_ADDRSTRLEN]; data/sniproxy-0.6.0/src/address.c:92:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(((struct sockaddr_un *)&sa)->sun_path, data/sniproxy-0.6.0/src/address.c:98: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(((struct sockaddr_un *)&sa)->sun_path) + 1); data/sniproxy-0.6.0/src/address.c:108:13: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ip_buf, hostname_or_ip, len); data/sniproxy-0.6.0/src/address.c:150:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ip_buf, hostname_or_ip + 1, len); data/sniproxy-0.6.0/src/address.c:165: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(hostname_or_ip); data/sniproxy-0.6.0/src/address.c:463: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 hostname_len = strlen(hostname); data/sniproxy-0.6.0/src/binder.c:156:13: [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(buffer, "Incomplete error:", sizeof(buffer)); data/sniproxy-0.6.0/src/binder.c:218:34: [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 (send(sockfd, buffer, strlen(buffer), 0) < 0) { data/sniproxy-0.6.0/src/cfg_parser.c:114:45: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strncmp(grammar->keyword, word, strlen(word)) == 0) data/sniproxy-0.6.0/src/cfg_tokenizer.c:42:18: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((ch = getc(config)) != EOF) { data/sniproxy-0.6.0/src/cfg_tokenizer.c:81:18: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((ch = getc(file)) != EOF) data/sniproxy-0.6.0/src/cfg_tokenizer.c:93:18: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((ch = getc(file)) != EOF && len < buffer_len) { data/sniproxy-0.6.0/src/config.c:464:55: [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 (strncasecmp(priorities[i].name, priority, strlen(priority)) == 0) { data/sniproxy-0.6.0/src/config.c:638:55: [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 (strncasecmp(resolver_mode_names[i], mode, strlen(mode)) == 0) { data/sniproxy-0.6.0/src/connection.c:376: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). buf_len = strlen(buf); data/sniproxy-0.6.0/src/connection.c:384: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). buf_len = strlen(buf); data/sniproxy-0.6.0/src/connection.c:403: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). buf_len = strlen(buf); data/sniproxy-0.6.0/src/connection.c:411: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). buf_len = strlen(buf); data/sniproxy-0.6.0/src/http.c:102: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/sniproxy-0.6.0/src/http.c:115: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/sniproxy-0.6.0/src/listener.c:285: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 (strncasecmp(protocol, http_protocol->name, strlen(protocol)) == 0) data/sniproxy-0.6.0/src/listener.c:412: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). if (strncmp("log", action, strlen(action)) == 0) { data/sniproxy-0.6.0/src/logger.c:269: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 len = strlen(buffer); data/sniproxy-0.6.0/src/logger.c:338:55: [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 (strncasecmp(facilities[i].name, facility, strlen(facility)) == 0) data/sniproxy-0.6.0/src/logger.c:497:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(dst, timestamp_cache.string, dst_len); data/sniproxy-0.6.0/src/sniproxy.c:188:5: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(022); data/sniproxy-0.6.0/src/tls.c:239:17: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(*hostname, (const char *)(data + pos + 3), len); data/sniproxy-0.6.0/tests/http_test.c:51:55: [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). result = http_protocol->parse_packet(good[i], strlen(good[i]), &hostname); data/sniproxy-0.6.0/tests/http_test.c:65: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). result = http_protocol->parse_packet(bad[i], strlen(bad[i]), &hostname); data/sniproxy-0.6.0/tests/table_test.c:40: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). server_query, strlen(server_query)); data/sniproxy-0.6.0/tests/table_test.c:77: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). server_query, strlen(server_query)); ANALYSIS SUMMARY: Hits = 115 Lines analyzed = 7881 in approximately 0.25 seconds (31950 lines/second) Physical Source Lines of Code (SLOC) = 5537 Hits@level = [0] 60 [1] 31 [2] 67 [3] 1 [4] 16 [5] 0 Hits@level+ = [0+] 175 [1+] 115 [2+] 84 [3+] 17 [4+] 16 [5+] 0 Hits/KSLOC@level+ = [0+] 31.6056 [1+] 20.7694 [2+] 15.1707 [3+] 3.07025 [4+] 2.88965 [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.