Menu

#98 Passing pcScopeList == NULL to SLPFindSrvs may lead to SEGV

v1.2.2
open
5
2017-04-07
2008-04-17
No

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.

Discussion

  • John Calcote

    John Calcote - 2017-04-07

    fixed in 2.0 code base.

     
  • John Calcote

    John Calcote - 2017-04-07
    • assigned_to: John Calcote
    • Group: --> v1.2.2
     

Log in to post a comment.