You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is an inconsistency in the mgos_ api versus the documented mg_ API for sending RPC messages. mg_ API docs explicitly state that the callback and callback args can be NULL for messages where no response is expected. However, in the mgos_ API does not check for NULL callbacks and therefore attempts to call a null function, causing a system crash. I have verified that adding a nop callback function in place of NULL in mgos_rpc_send() resolves the crashing issues.
This could be remedied in one of two ways based on my examination of the code:
Hello.
There is an inconsistency in the
mgos_
api versus the documentedmg_
API for sending RPC messages.mg_
API docs explicitly state that the callback and callback args can beNULL
for messages where no response is expected. However, in themgos_
API does not check forNULL
callbacks and therefore attempts to call a null function, causing a system crash. I have verified that adding a nop callback function in place ofNULL
inmgos_rpc_send()
resolves the crashing issues.This could be remedied in one of two ways based on my examination of the code:
mgos_rpc_call_oplya()
(https://github.com/mongoose-os-libs/rpc-common/blob/master/src/mgos_rpc.c#L574-L603) can check forNULL
inoplya_arg->cb
before attempting to call the function,or,
mgos_rpc_call()
(https://github.com/mongoose-os-libs/rpc-common/blob/master/src/mgos_rpc.c#L605-L620) to check for NULL and adjust the args for themg_rpc_callf()
call accordingly.I consider the second to be preferable to avoid unnecessary heap allocation.
Please let me know if you need more information.
The text was updated successfully, but these errors were encountered: