Decide whether `response` can be framed, substituting the error when it * cannot. Owns `response` either way and returns the reply to send, or NULL * only on allocation failure. This is ONE function on purpose: the bug was the * DECISION (an oversized reply travelling on as if it were fine), so the * decision and the substitution have to be testable together — a test that * only builds the er
| 2396 | * decision and the substitution have to be testable together — a test that |
| 2397 | * only builds the error passes even with the size check removed. */ |
| 2398 | static char *application_framable_response(char *response, const cbm_jsonrpc_request_t *request) { |
| 2399 | if (!response || strlen(response) <= CBM_DAEMON_RUNTIME_APPLICATION_PAYLOAD_MAX) { |
| 2400 | return response; |
| 2401 | } |
| 2402 | char *replacement = application_oversized_response_error(request, strlen(response)); |
| 2403 | free(response); |
| 2404 | return replacement; |
| 2405 | } |
| 2406 | |
| 2407 | char *cbm_daemon_application_framable_response_for_test(char *response, |
| 2408 | const cbm_jsonrpc_request_t *request) { |
no test coverage detected