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

Jeremy Allison jra at samba.org
Mon Jul 1 11:18:27 MDT 2013


On Mon, Jul 01, 2013 at 05:05:33PM +0200, Andreas Schneider wrote:
> 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

LGTM. Pushed !


More information about the samba-technical mailing list