[PATCH] talloc_zero libnet_context on init

Christof Schmitt cs at samba.org
Wed Jan 31 18:35:07 UTC 2018


On Fri, Jan 26, 2018 at 09:17:32AM +0100, Swen Schillig via samba-technical wrote:
> Hi.
> 
> Small patch preventing uninitalized cli_credentials.
> 
> Please review.

lgtm

Reviewed-by: Christof Schmitt <cs at samba.org>

Can we get another team reviewer?

Christof

> 
> Thanks.
> 
> Cheers Swen

> From 85b9b59079b20b89197f599fff319cfde28c65c1 Mon Sep 17 00:00:00 2001
> From: Swen Schillig <swen at vnet.ibm.com>
> Date: Fri, 26 Jan 2018 09:12:12 +0100
> Subject: [PATCH] talloc_zero libnet_context on init
> 
> Zero the libnet_context on initialization
> preventing an uninitalized cli_credentials struct.
> 
> Signed-off-by: Swen Schillig <swen at vnet.ibm.com>
> ---
>  source4/libnet/libnet.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/source4/libnet/libnet.c b/source4/libnet/libnet.c
> index 32df85d5279..a590893bee2 100644
> --- a/source4/libnet/libnet.c
> +++ b/source4/libnet/libnet.c
> @@ -33,8 +33,8 @@ struct libnet_context *libnet_context_init(struct tevent_context *ev,
>  		return NULL;
>  	}
>  
> -	/* create brand new libnet context */ 
> -	ctx = talloc(ev, struct libnet_context);
> +	/* create brand new libnet context */
> +	ctx = talloc_zero(ev, struct libnet_context);
>  	if (!ctx) {
>  		return NULL;
>  	}
> @@ -48,14 +48,8 @@ struct libnet_context *libnet_context_init(struct tevent_context *ev,
>  	/* name resolution methods */
>  	ctx->resolve_ctx = lpcfg_resolve_context(lp_ctx);
>  
> -	/* connected services' params */
> -	ZERO_STRUCT(ctx->samr);
> -	ZERO_STRUCT(ctx->lsa);	
> -
>  	/* default buffer size for various operations requiring specifying a buffer */
>  	ctx->samr.buf_size = 128;
>  
> -	ctx->server_address = NULL;
> -
>  	return ctx;
>  }
> -- 
> 2.14.3
> 




More information about the samba-technical mailing list