Skip to content
Snippets Groups Projects
Unverified Commit 1f6ea0ec authored by José Ignacio Alamos Aste's avatar José Ignacio Alamos Aste Committed by GitHub
Browse files

Merge pull request #10331 from miri64/emb6/fix/sock-info-src

emb6_sock_udp: copy receive remote correctly
parents f6043e04 a077dc57
No related branches found
No related tags found
No related merge requests found
...@@ -187,7 +187,7 @@ int sock_udp_recv(sock_udp_t *sock, void *data, size_t max_len, ...@@ -187,7 +187,7 @@ int sock_udp_recv(sock_udp_t *sock, void *data, size_t max_len,
if (remote != NULL) { if (remote != NULL) {
remote->family = AF_INET6; remote->family = AF_INET6;
remote->netif = SOCK_ADDR_ANY_NETIF; remote->netif = SOCK_ADDR_ANY_NETIF;
memcpy(&remote->addr, &sock->recv_info.src, sizeof(ipv6_addr_t)); memcpy(&remote->addr, sock->recv_info.src, sizeof(ipv6_addr_t));
remote->port = sock->recv_info.src_port; remote->port = sock->recv_info.src_port;
} }
res = (int)sock->recv_info.datalen; res = (int)sock->recv_info.datalen;
...@@ -235,11 +235,11 @@ int sock_udp_send(sock_udp_t *sock, const void *data, size_t len, ...@@ -235,11 +235,11 @@ int sock_udp_send(sock_udp_t *sock, const void *data, size_t len,
else if (sock->sock.udp_conn->rport == 0) { else if (sock->sock.udp_conn->rport == 0) {
return -ENOTCONN; return -ENOTCONN;
} }
/* cppcheck-supress nullPointerRedundantCheck /* cppcheck-suppress nullPointerRedundantCheck
* remote == NULL implies that sock != NULL (see assert at start of * (reason: remote == NULL implies that sock != NULL (see assert at start of
* function) * that's why it is okay in the if-statement above to check * function) * that's why it is okay in the if-statement above to check
* sock->... without checking (sock != NULL) first => this check afterwards * sock->... without checking (sock != NULL) first => this check afterwards
* isn't redundant */ * isn't redundant) */
if (sock == NULL) { if (sock == NULL) {
int res; int res;
if ((res = _reg(&tmp, NULL, NULL, NULL, NULL)) < 0) { if ((res = _reg(&tmp, NULL, NULL, NULL, NULL)) < 0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment