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.
46 lines
1.2 KiB
Makefile
46 lines
1.2 KiB
Makefile
# tests/Makefile.am
|
|
#
|
|
# Copyright (C) 2015-2016 Carsten Schoenert <c.schoenert@t-online.de>
|
|
#
|
|
# SPDX-License-Identifier: BSD-2-Clause
|
|
#
|
|
# This file is part of the CoAP C library libcoap. Please see README and
|
|
# COPYING for terms of use.
|
|
|
|
# just do anything if 'HAVE_CUNIT' is defined
|
|
if HAVE_CUNIT
|
|
|
|
# picking up the default warning CFLAGS
|
|
AM_CFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include $(WARNING_CFLAGS) $(CUNIT_CFLAGS) $(DTLS_CFLAGS) -std=c99 $(EXTRA_CFLAGS)
|
|
|
|
noinst_PROGRAMS = \
|
|
testdriver
|
|
|
|
testdriver_SOURCES = \
|
|
testdriver.c \
|
|
test_block.c \
|
|
test_error_response.c \
|
|
test_encode.c \
|
|
test_options.c \
|
|
test_pdu.c \
|
|
test_sendqueue.c \
|
|
test_session.c \
|
|
test_uri.c \
|
|
test_wellknown.c \
|
|
test_tls.c \
|
|
test_oscore.c
|
|
|
|
# The .a file is uses instead of .la so that testdriver can always access the
|
|
# internal functions that are not globally exposed in a .so file.
|
|
testdriver_LDADD = $(CUNIT_LIBS) $(top_builddir)/.libs/libcoap-$(LIBCOAP_NAME_SUFFIX).a ${DTLS_LIBS}
|
|
|
|
# If there is a API change to something $(LIBCOAP_API_VERSION) > 1 there is
|
|
# nothing to adopt here. No needed to implement something here because the test
|
|
# unit will always be build against the actual header files!
|
|
|
|
CLEANFILES = testdriver
|
|
|
|
all-am: testdriver
|
|
|
|
endif # HAVE_CUNIT
|