diff options
author | Andreas Schneider <asn@samba.org> | 2016-06-22 15:36:59 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2016-06-30 02:53:01 +0200 |
commit | 4524f5986c3cc6430fcc2ddae6970a62b3f22ac8 (patch) | |
tree | a9ced0f371c43dab0ee3854f7bbb5d953b265a3d /lib/tsocket | |
parent | 1d4b20d4f3829eb3778006397990cd9fee4966a5 (diff) | |
download | samba-4524f5986c3cc6430fcc2ddae6970a62b3f22ac8.tar.gz |
tsocket: Do not dereference a NULL pointer
Make sure the lrbsda pointer is not allocated and we will
not end up dereferencing a NULL pointer. In practice this
can't happen, but this change links the pointer with the
code that uses it.
Found by Coverity.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jun 30 02:53:02 CEST 2016 on sn-devel-144
Diffstat (limited to 'lib/tsocket')
-rw-r--r-- | lib/tsocket/tsocket_bsd.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/tsocket/tsocket_bsd.c b/lib/tsocket/tsocket_bsd.c index 9608dded535..708d17edc32 100644 --- a/lib/tsocket/tsocket_bsd.c +++ b/lib/tsocket/tsocket_bsd.c @@ -2327,10 +2327,14 @@ static struct tevent_req *tstream_bsd_connect_send(TALLOC_CTX *mem_ctx, goto post; } - ret = getsockname(state->fd, &lrbsda->u.sa, &lrbsda->sa_socklen); - if (ret == -1) { - tevent_req_error(req, errno); - goto post; + if (lrbsda != NULL) { + ret = getsockname(state->fd, + &lrbsda->u.sa, + &lrbsda->sa_socklen); + if (ret == -1) { + tevent_req_error(req, errno); + goto post; + } } tevent_req_done(req); |