1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-26 21:57:41 +03:00

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>
This commit is contained in:
Volker Lendecke 2019-09-24 10:29:07 -07:00 committed by Ralph Boehme
parent 34a35ac15e
commit 5d8493f5b4

View File

@ -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;
if ((result->desthost == NULL) || (result->srv_name_slash == NULL)) {
result->desthost = talloc_strdup(
result, smbXcli_conn_remote_name(cli->conn));
if (result->desthost == NULL) {
TALLOC_FREE(result);
return NT_STATUS_NO_MEMORY;
}
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)) {