[PATCH] rpcrt4: Fixed incorrect NULL check condition (Coverity)

Rob Shearman robertshearman at gmail.com
Sat Nov 7 09:57:51 CST 2009


2009/10/17 Marcus Meissner <marcus at jet.franken.de>:
> Hi,
>
> Coverity spotted that this could lead to NULL dereference,
> and yes, the && should be ||.

This is not what was intended. The code inside the if block shouldn't
execute if assoc->NetworkOptions is NULL and NetworkOptions isn't and
vice-versa. The comparison should probably be split into a separate
function.

> @@ -97,7 +97,7 @@ RPC_STATUS RPCRT4_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr,
>         if (!strcmp(Protseq, assoc->Protseq) &&
>             !strcmp(NetworkAddr, assoc->NetworkAddr) &&
>             !strcmp(Endpoint, assoc->Endpoint) &&
> -            ((!assoc->NetworkOptions && !NetworkOptions) || !strcmpW(NetworkOptions, assoc->NetworkOptions)))
> +            (!assoc->NetworkOptions || !NetworkOptions || !strcmpW(NetworkOptions, assoc->NetworkOptions)))

Thanks,
-- 
Rob Shearman



More information about the wine-devel mailing list