mirror of
https://github.com/obgm/libcoap.git
synced 2026-10-28 13:35:47 +03:00
For a request set up with coap_add_data_large_request_app(), the data is provided by the application's get_func and there is no data pointer. Three places still took the body from that NULL pointer, so coap_add_data() was passed a NULL pointer: - check_freshness(), re-sending the next block with the Echo option from a 4.01 response. - coap_cancel_observe_lkd(), re-adding the observe request's body to the cancel request. - coap_add_data_large_internal(), when the application sets a Block1 option with a non-zero block number to send a single block. Use get_func in all of these, as the other places that send a block of an lg_xmit already do. The single block and the whole-body cases now share add_get_func_data(), which also checks the allocation and no longer leaks the buffer when get_func fails. Add unit tests.
14 lines
293 B
C
14 lines
293 B
C
/* libcoap unit tests
|
|
*
|
|
* Copyright (C) 2026 Alejandro Pacheco <alepacheco99@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*
|
|
* This file is part of the CoAP library libcoap. Please see
|
|
* README for terms of use.
|
|
*/
|
|
|
|
#include <CUnit/CUnit.h>
|
|
|
|
CU_pSuite t_init_block_tests(void);
|