rpc_callback_call(): Check if nrp parameter is NULL to avoid SEGV

This commit is contained in:
Olof hagsand 2021-12-05 12:34:59 +01:00
parent 478911d0f5
commit 854958b5e8
2 changed files with 9 additions and 5 deletions

View file

@ -1120,7 +1120,7 @@ rpc_callback_delete_all(clicon_handle h)
* @param[in] h clicon handle
* @param[in] xn Sub-tree (under xorig) at child of rpc: <rpc><xn></rpc>.
* @param[in] arg Domain-speific arg (eg client_entry)
* @param[out] nr Number of callbacks handled: 0, 1, n (retval = 1)
* @param[out] nrp Number of callbacks handled: 0, 1, n (retval = 1) or NULL
* @param[out] cbret Return XML (as string in CLIgen buffer), error or OK
* @retval -1 Error
* @retval 0 Failed, error return in cbret
@ -1180,7 +1180,8 @@ rpc_callback_call(clicon_handle h,
if (ret == 0)
goto fail;
}
*nrp = nr;
if (nrp)
*nrp = nr;
retval = 1; /* 0: none found, >0 nr of handlers called */
done:
clicon_debug(1, "%s retval:%d", __FUNCTION__, retval);