X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=src%2Ftlsproxy.c;h=9cca1ad506364ba40b03d0efe983b91557ec9dbf;hb=6b497d719313abe2e8adcd431778869df206e5be;hp=6d49253681ea05ff92b27c8e3a3e71de3d7ee5fa;hpb=071dd5923aa311dc6830904a4e31db227ea08995;p=tlsproxy%2Ftlsproxy.git diff --git a/src/tlsproxy.c b/src/tlsproxy.c index 6d49253..9cca1ad 100644 --- a/src/tlsproxy.c +++ b/src/tlsproxy.c @@ -26,13 +26,14 @@ #include #include #include +#include +#include #include #include +#include #include #include #include -#include -#include #if GNUTLS_VERSION_NUMBER <= 0x020b00 /* Necessary for GnuTLS when used with threads. */ @@ -150,9 +151,9 @@ int main(int argc, char **argv) { } #ifdef USE_IPV4_ONLY - server_socket = socket(PF_INET, SOCK_STREAM, 0); + server_socket = socket(AF_INET, SOCK_STREAM, 0); #else - server_socket = socket(PF_INET6, SOCK_STREAM, 0); + server_socket = socket(AF_INET6, SOCK_STREAM, 0); #endif if (server_socket < 0) { perror("socket()"); @@ -316,12 +317,11 @@ static void parse_arguments(int argc, char **argv) { memcpy(global_proxy_host, optarg, (size_t)(position - optarg)); global_proxy_host[position - optarg] = '\0'; - global_proxy_port = malloc(strlen(position + 1) + 1); + global_proxy_host = strdup(position + 1); if (global_proxy_port == NULL) { - perror("malloc()"); + perror("strdup()"); exit(EXIT_FAILURE); } - strcpy(global_proxy_port, position + 1); break; }