Passing pcScopeList == NULL to SLPFindSrvs may lead to SEGV
Brought to you by:
jcalcote
Passing pcScopeList == NULL to SLPFindSrvs may lead to SIGSEGV.
This is because in the following code:
if(pcScopeList && *pcScopeList)
{
handle->params.findsrvs.scopelistlen = strlen(pcScopeList);
handle->params.findsrvs.scopelist = pcScopeList;
}
else
{
handle->params.findsrvs.scopelist = SLPGetProperty("net.slp.useScopes");
handle->params.findsrvs.scopelistlen = strlen(handle->params.findsrvs.scopelist);
}
If the second branch is entered and SLPGetProperty() returns NULL pointer (according to its code it can) then you the next line will fail with SIGSEGV since this is the way strlen() behaves on NULL pointers.
The bug occurred during real execution so it is not just theoretical problem.
The version used was 1.2.1.
fixed in 2.0 code base.