Re: [PATCH] rpcrt4: Fixed incorrect NULL check condition (Coverity)
2009/10/17 Marcus Meissner <marcus(a)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
participants (1)
-
Rob Shearman