[PATCH] Check for negative return value in dcerpc_sock.c
Jeremy Allison
jra at samba.org
Wed Jun 22 16:53:20 UTC 2016
On Wed, Jun 22, 2016 at 09:31:16AM +0200, Andreas Schneider wrote:
> Review and push appreciated!
Can't see a codepath sock_fd==-1 would break anything,
but this is an obvious enough cleanup (and if Coverity
complains.... :-).
Pushed !
>
> -- andreas
>
> --
> Andreas Schneider GPG-ID: CC014E3D
> Samba Team asn at samba.org
> www.samba.org
> From fded8db1e2ee60a19b1890f9357d21715798fa40 Mon Sep 17 00:00:00 2001
> From: Andreas Schneider <asn at samba.org>
> Date: Wed, 22 Jun 2016 09:25:16 +0200
> Subject: [PATCH] librpc: Check for negative return value of socket_get_fd()
>
> Found by Coverity.
>
> Signed-off-by: Andreas Schneider <asn at samba.org>
> ---
> source4/librpc/rpc/dcerpc_sock.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/source4/librpc/rpc/dcerpc_sock.c b/source4/librpc/rpc/dcerpc_sock.c
> index f5a1c07..7175eb2 100644
> --- a/source4/librpc/rpc/dcerpc_sock.c
> +++ b/source4/librpc/rpc/dcerpc_sock.c
> @@ -72,6 +72,11 @@ static void continue_socket_connect(struct composite_context *ctx)
> return;
> }
> sock_fd = socket_get_fd(s->socket_ctx);
> + if (sock_fd == -1) {
> + TALLOC_FREE(s->socket_ctx);
> + composite_error(c, NT_STATUS_INVALID_HANDLE);
> + return;
> + }
> socket_set_flags(s->socket_ctx, SOCKET_FLAG_NOCLOSE);
> TALLOC_FREE(s->socket_ctx);
>
> --
> 2.9.0
>
More information about the samba-technical
mailing list