Segmentation fault in coap_new_client_session
torres98 opened this issue · comments
Environment
- Build System: Make 4.3 | CMake 3.27.4
- Operating System: Ubuntu 22.04.03 LTS
- Hosted Environment: None
libcoap Configuration Summary
Problem Description
Whenever i call the coap_new_client_session
i get a segmentation fault with the 4.3.2 and 4.3.3 tagged versions (while using 4.3.1 doesn't raise this problem).
Expected Behavior
No segfault during the call.
Actual Behavior
I get a segmentation fault during the coap_new_client_session
function call. With debugging enabled, i end up with the following sequence of calls before the segfault:
coap_new_client_session
coap_session_create_client
coap_netif_dgrm_connect
(at coap_session.c:1189)coap_socket_connect_udp
(at coap_netif.c:55)coap_is_mcast
(at coap_io.c:222)coap_is_bcast
(at coap_address.c:118)
segfault at coap_address.c:217
Local variables at segfault time:
ifa = 0x5555555b8830
ife = 0x5555555b88e8
ipv4 = {s_addr = 16777343}
i = 32767
now = 39161
Steps to reproduce
After installing libcoap with the tagged versions 4.3.2 or 4.3.3, compile the client source code with the following command:
gcc client.c -l coap-3 -o client
./client
Code to reproduce this issue
Debug Logs
Only a (not meaningful) debug line is printed with the minimum debug level.
I noticed that on develop this has been fixed, closing it.
Yes, develop branch fixes a NULL ptr issue when getifaddrs()
returns a struct ifaddrs
that does not have ifa_addr
set.