From: Daniel Wagner <[email protected]>
get_req_upd_socket() might return -1 instead of a socket. All other
caller test for validity.
Reported by coverity.
---
src/dnsproxy.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/dnsproxy.c b/src/dnsproxy.c
index 91827cb..584640a 100644
--- a/src/dnsproxy.c
+++ b/src/dnsproxy.c
@@ -1812,8 +1812,12 @@ static int forward_dns_reply(unsigned char *reply, int
reply_len, int protocol,
if (protocol == IPPROTO_UDP) {
sk = get_req_udp_socket(req);
- err = sendto(sk, req->resp, req->resplen, 0,
- &req->sa, req->sa_len);
+ if (sk < 0) {
+ errno = -EIO;
+ err = -EIO;
+ } else
+ err = sendto(sk, req->resp, req->resplen, 0,
+ &req->sa, req->sa_len);
} else {
sk = req->client_sk;
err = send(sk, req->resp, req->resplen, MSG_NOSIGNAL);
--
1.8.4.474.g128a96c
_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman