From: Daniel Wagner <[email protected]>

get_req_udp_socket() returns -1 if something goes wrong,
therefore we should also handle this correctly.

Reported by coverity.
---
 src/dnsproxy.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/dnsproxy.c b/src/dnsproxy.c
index 7c83883..91827cb 100644
--- a/src/dnsproxy.c
+++ b/src/dnsproxy.c
@@ -1625,6 +1625,9 @@ static int ns_resolv(struct server_data *server, struct 
request_data *req,
                if (data && req->protocol == IPPROTO_UDP) {
                        int udp_sk = get_req_udp_socket(req);
 
+                       if (udp_sk < 0)
+                               return -EIO;
+
                        send_cached_response(udp_sk, data->data,
                                data->data_len, &req->sa, req->sa_len,
                                IPPROTO_UDP, req->srcid, data->answers,
-- 
1.8.4.474.g128a96c

_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman

Reply via email to