diff options
author | Volker Lendecke <vl@samba.org> | 2019-09-24 10:29:07 -0700 |
---|---|---|
committer | Ralph Boehme <slow@samba.org> | 2019-10-02 08:01:40 +0000 |
commit | 5d8493f5b459a7b91f9a5ca9dee00c968fab3d67 (patch) | |
tree | 0567537adc99ccd258f837d8fd0de26b1b39e4d8 | |
parent | 34a35ac15efee431a7848da51409f7dcdf95b48b (diff) | |
download | samba-5d8493f5b459a7b91f9a5ca9dee00c968fab3d67.tar.gz |
rpc_client: Don't pass a NULL string to talloc_asprintf
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
-rw-r--r-- | source3/rpc_client/cli_pipe.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index 78197d99f9c..1276eaf9807 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -2665,9 +2665,14 @@ static NTSTATUS rpc_pipe_open_tcp_port(TALLOC_CTX *mem_ctx, const char *host, result->transfer_syntax = ndr_transfer_syntax_ndr; result->desthost = talloc_strdup(result, host); + if (result->desthost == NULL) { + status = NT_STATUS_NO_MEMORY; + goto fail; + } + result->srv_name_slash = talloc_asprintf_strupper_m( result, "\\\\%s", result->desthost); - if ((result->desthost == NULL) || (result->srv_name_slash == NULL)) { + if (result->srv_name_slash == NULL) { status = NT_STATUS_NO_MEMORY; goto fail; } @@ -2912,9 +2917,14 @@ NTSTATUS rpc_pipe_open_ncalrpc(TALLOC_CTX *mem_ctx, const char *socket_path, result->transfer_syntax = ndr_transfer_syntax_ndr; result->desthost = get_myname(result); + if (result->desthost == NULL) { + status = NT_STATUS_NO_MEMORY; + goto fail; + } + result->srv_name_slash = talloc_asprintf_strupper_m( result, "\\\\%s", result->desthost); - if ((result->desthost == NULL) || (result->srv_name_slash == NULL)) { + if (result->srv_name_slash == NULL) { status = NT_STATUS_NO_MEMORY; goto fail; } @@ -3006,17 +3016,23 @@ static NTSTATUS rpc_pipe_open_np(struct cli_state *cli, result->abstract_syntax = table->syntax_id; result->transfer_syntax = ndr_transfer_syntax_ndr; - result->desthost = talloc_strdup(result, smbXcli_conn_remote_name(cli->conn)); - result->srv_name_slash = talloc_asprintf_strupper_m( - result, "\\\\%s", result->desthost); - result->max_xmit_frag = RPC_MAX_PDU_FRAG_LEN; + result->desthost = talloc_strdup( + result, smbXcli_conn_remote_name(cli->conn)); + if (result->desthost == NULL) { + TALLOC_FREE(result); + return NT_STATUS_NO_MEMORY; + } - if ((result->desthost == NULL) || (result->srv_name_slash == NULL)) { + result->srv_name_slash = talloc_asprintf_strupper_m( + result, "\\\\%s", result->desthost); + if (result->srv_name_slash == NULL) { TALLOC_FREE(result); return NT_STATUS_NO_MEMORY; } + result->max_xmit_frag = RPC_MAX_PDU_FRAG_LEN; + status = rpc_transport_np_init(result, cli, table, &result->transport); if (!NT_STATUS_IS_OK(status)) { |