mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-13 03:40:40 +03:00
coap-client.c: Fix case when no host is specified in the URI
If the host has not been specified in the URI, do not add in an empty Uri-Host option as that is illegal.
This commit is contained in:
1 parent
7aa003bbe7
commit
088fff1a82
1 file changed
+1
-1
@@ -1746,7 +1746,7 @@ main(int argc, char **argv) {
|
||||
|
||||
/* construct CoAP message */
|
||||
|
||||
if (!uri_host_option && (!proxy.host.length && addrptr
|
||||
if (!uri_host_option && (!proxy.host.length && uri.host.length && addrptr
|
||||
&& (inet_ntop(dst.addr.sa.sa_family, addrptr, addr, sizeof(addr)) != 0)
|
||||
&& (strlen(addr) != uri.host.length
|
||||
|| memcmp(addr, uri.host.s, uri.host.length) != 0)
|
||||
|
||||
Reference in new issue
Block a user