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

@ -35,11 +35,14 @@
## 5.5.0 ## 5.5.0
Planned: January, 2022 Planned: January, 2022
### Corrected Bugs
### Minor features ### Minor features
* Changed typo `configure --with-yang-standard-installdir` to `configure --with-yang-standard-dir` * Changed typo `configure --with-yang-standard-installdir` to `configure --with-yang-standard-dir
`
### Corrected Bugs
* rpc_callback_call(): Check if nrp parameter is NULL to avoid SEGV
## 5.4.0 ## 5.4.0
30 November, 2021 30 November, 2021

View file

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