HI,
I think that the modem_info_json_string_encode function from modem info library has a problem.
The functions crashes when all modem info data options are enabled in the configuration.
I have tracked down the problem to the size of the internal buffer cJSON_PrintUnformated function.
Near the end of modem_info_json_string_encode there is as line
char *root_obj_string = cJSON_PrintUnformatted(root_obj);
which has to convert json object to string. Internal buffer for cJSON_PrintUnformatted is 256 bytes, which is not enough.
I guess that cJSON functions does not check for buffer overflow.
My solution was to change cJSON_PrintUnformatted function with
cJSON_PrintPreallocated(root_obj, buf, MODEM_INFO_JSON_STRING_SIZE, false);
аnd to use predefined buffer with that size.
And of course the next two functions memcpy and cJSON_FreeString are unnecessary.