[PATCH] More coverity fixes

David Disseldorp ddiss at suse.de
Wed Mar 4 04:05:38 MST 2015


On Wed, 4 Mar 2015 10:57:24 +0100, Volker Lendecke wrote:


> +     len = strlcpy(state->addr.sun_path, sock,
> +                   sizeof(state->addr.sun_path));
> +     if (len >= sizeof(state->addr.sun_path)) {
> +             tevent_req_error(req, ENAMETOOLONG);
> +             return tevent_req_post(req, ev);
> +     }

This looks like a false positive from Coverity - a check is already
done higher up:
 73         if (strlen(sock) >= sizeof(state->addr.sun_path)) {
 74                 tevent_req_error(req, ENAMETOOLONG);


> -	TDB_DATA data;
> +	TDB_DATA data, rdata;
>  	int32_t cstatus = 0;
>  
>  	data.dptr = (uint8_t*)&db_id;
> @@ -1311,7 +1311,7 @@ char *ctdbd_dbpath(struct ctdbd_connection *conn,
>  
>  	status = ctdbd_control(conn, CTDB_CURRENT_NODE,
>  			       CTDB_CONTROL_GETDBPATH, 0, 0, data,
> -			       mem_ctx, &data, &cstatus);
> +			       mem_ctx, &rdata, &cstatus);

IIUC, this breaks the return value...
1320         return (char *)data.dptr;

Cheers, David


More information about the samba-technical mailing list