From: Günther Deschner Date: Thu, 19 Dec 2019 12:49:53 +0000 (+0100) Subject: s3-rpcclient: properly check and initialize buffers in getdriverpackagepath X-Git-Tag: ldb-2.1.0~82 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a340aecdd025352bd0cefc1be1aac7526dfe1748;p=thirdparty%2Fsamba.git s3-rpcclient: properly check and initialize buffers in getdriverpackagepath Guenther Signed-off-by: Guenther Deschner Reviewed-by: Jeremy Allison --- diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c index 4500ec39f9e..dbcfd17dba2 100644 --- a/source3/rpcclient/cmd_spoolss.c +++ b/source3/rpcclient/cmd_spoolss.c @@ -1630,7 +1630,10 @@ static WERROR cmd_spoolss_getdriverpackagepath(struct rpc_pipe_client *cli, } offered = 1; - cab = talloc_array(mem_ctx, char, offered); + cab = talloc_zero_array(mem_ctx, char, offered); + if (cab == NULL) { + return WERR_NOT_ENOUGH_MEMORY; + } status = dcerpc_spoolss_GetPrinterDriverPackagePath(b, mem_ctx, cli->srv_name_slash, env, @@ -1647,7 +1650,9 @@ static WERROR cmd_spoolss_getdriverpackagepath(struct rpc_pipe_client *cli, if (W_ERROR_EQUAL(W_ERROR(WIN32_FROM_HRESULT(hresult)), WERR_INSUFFICIENT_BUFFER)) { offered = needed; cab = talloc_zero_array(mem_ctx, char, offered); - + if (cab == NULL) { + return WERR_NOT_ENOUGH_MEMORY; + } status = dcerpc_spoolss_GetPrinterDriverPackagePath(b, mem_ctx, cli->srv_name_slash, env,