[PATCH] tsocket: Pass the full port number to getaddrinfo().

Andreas Schneider asn at samba.org
Mon Jul 1 09:05:33 MDT 2013


The code stripped port numbers above 9999 down to 4 digits.

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 lib/tsocket/tsocket_bsd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/tsocket/tsocket_bsd.c b/lib/tsocket/tsocket_bsd.c
index 4417f8e..fe39dfd 100644
--- a/lib/tsocket/tsocket_bsd.c
+++ b/lib/tsocket/tsocket_bsd.c
@@ -389,7 +389,7 @@ int _tsocket_address_inet_from_strings(TALLOC_CTX *mem_ctx,
 		return -1;
 	}
 
-	snprintf(port_str, sizeof(port_str) - 1, "%u", port);
+	snprintf(port_str, sizeof(port_str), "%u", port);
 
 	ret = getaddrinfo(addr, port_str, &hints, &result);
 	if (ret != 0) {
-- 
1.8.3.1




More information about the samba-technical mailing list