From: Michael Rash Date: Sat, 1 Sep 2012 03:05:05 +0000 (-0400) Subject: get MAX_PORT_STR_LEN constant from fko_message.h X-Git-Tag: fwknop-2.0.3~11 X-Git-Url: http://www.cipherdyne.com/cgi-bin/gitweb.cgi?p=fwknop.git;a=commitdiff_plain;h=1548cbafc886af802b639913bb10e6a746222478 get MAX_PORT_STR_LEN constant from fko_message.h --- diff --git a/client/spa_comm.c b/client/spa_comm.c index 53ba1a3..eabdb58 100644 --- a/client/spa_comm.c +++ b/client/spa_comm.c @@ -118,7 +118,7 @@ send_spa_packet_tcp_or_udp(const char *spa_data, const int sd_len, { int sock, res=0, error; struct addrinfo *result, *rp, hints; - char port_str[MAX_PORT_STR_LEN]; + char port_str[MAX_PORT_STR_LEN+1]; if (options->test) { @@ -147,7 +147,7 @@ send_spa_packet_tcp_or_udp(const char *spa_data, const int sd_len, hints.ai_protocol = IPPROTO_TCP; } - snprintf(port_str, MAX_PORT_STR_LEN, "%d", options->spa_dst_port); + snprintf(port_str, MAX_PORT_STR_LEN+1, "%d", options->spa_dst_port); error = getaddrinfo(options->spa_server_str, port_str, &hints, &result); diff --git a/client/utils.c b/client/utils.c index 1e5ee2f..02718ce 100644 --- a/client/utils.c +++ b/client/utils.c @@ -28,6 +28,7 @@ * ***************************************************************************** */ +#include "fwknop_common.h" #include "utils.h" /* Generic hex dump function. diff --git a/common/common.h b/common/common.h index 0c1c26d..9ec4388 100644 --- a/common/common.h +++ b/common/common.h @@ -102,8 +102,6 @@ enum { #define DEFAULT_NAT_PORT 55000 #define MIN_HIGH_PORT 10000 /* sensible minimum for SPA dest port */ #define MAX_PORT 65535 -#define MAX_PORT_STR_LEN 6 -#define MAX_PROTO_STR_LEN 6 #define MAX_SERVER_STR_LEN 50 #define MAX_LINE_LEN 1024 diff --git a/lib/fko.h b/lib/fko.h index 4910b17..08c652e 100644 --- a/lib/fko.h +++ b/lib/fko.h @@ -33,6 +33,7 @@ #include #include "fko_limits.h" +#include "fko_message.h" #ifdef __cplusplus extern "C" {