Skip to content

Commit

Permalink
s3-rpcclient: properly check and initialize buffers in getdriverpacka…
Browse files Browse the repository at this point in the history
…gepath

Guenther

Signed-off-by: Guenther Deschner <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
  • Loading branch information
gd authored and jrasamba committed Jan 8, 2020
1 parent 479cf55 commit a340aec
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions source3/rpcclient/cmd_spoolss.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit a340aec

Please sign in to comment.