[PATCH] Do not dereference a NULL pointer in tsocket

Stefan Metzmacher metze at samba.org
Wed Jun 22 18:14:36 UTC 2016


Am 22.06.2016 um 19:15 schrieb Jeremy Allison:
> On Wed, Jun 22, 2016 at 03:39:28PM +0200, Andreas Schneider wrote:
>> Review and push appreciated!
> 
> Should this be
> 
> if (lrbsda != NULL) {
> 
> instead of:
> 
> if (is_inet) {

This is not needed at all!

The code looks like this:

        if (!state->local) {
                tevent_req_done(req);
                goto post;
        }

        ret = getsockname(state->fd, &lrbsda->u.sa, &lrbsda->sa_socklen);
        if (ret == -1) {
                tevent_req_error(req, errno);
                goto post;
        }

And state->local is NULL unless is_inet is set.

I think we should not blindly fix coverity bugs,
when there's no real problem.

We may change if (!state->local) into if (lrbsda == NULL),
maybe that makes coverity more happy.

metze

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160622/810afb4f/signature.sig>


More information about the samba-technical mailing list