Using mDash 1.2.15, a registered jsonrpc callback is receiving a struct *rwhere the params and params_len fields are incorrect. The example below is a dump from an ESP32 application that received an RPC request for method “set_schedule” from the mDash dashboard with payload
{"PS1":{"IV":3}}
The full request is correctly represented by the r->frame and r->frame_len fields as
{"id":14,"method":"set_schedule","params":{"PS1":{"IV":3}}}
The pointer and len fields for frame, params, id, and method are received as:
frame=0x3ffe685e (60), params=0x3f414116 (0), id=0x3ffe6864 (2) method=0x3ffe6870 (14)
but params does not point within the buffer pointed to by frame and params_len should not be 0. The correct values for params and params_len, given the value of frame are:
params=0x3ffe6888 (16)
Assuming the formatting of the jsonrpc frame is constant, one can work around this bug with the following lines of code:
r->params = r->method + r->method_len + 10;
r->params_len = r->frame_len - (r->id_len + 6) - (r->method_len + 10) - 10 - 2;
I’m reporting this in case it might save anyone else some time.