dns_client: fix crash issue when upstream response delay is lower than 1ms

This commit is contained in:
Nick Peng
2022-11-07 19:57:17 +08:00
parent 5558e38cb4
commit facf672081
2 changed files with 8 additions and 5 deletions

View File

@@ -908,7 +908,7 @@ static int _dns_server_reply_udp(struct dns_request *request, struct dns_server_
struct iovec iovec[1];
struct msghdr msg;
struct cmsghdr *cmsg;
char msg_control[256];
char msg_control[64];
if (atomic_read(&server.run) == 0 || inpacket == NULL || inpacket_len <= 0) {
return -1;
@@ -916,6 +916,7 @@ static int _dns_server_reply_udp(struct dns_request *request, struct dns_server_
iovec[0].iov_base = inpacket;
iovec[0].iov_len = inpacket_len;
memset(msg_control, 0, sizeof(msg_control));
msg.msg_iov = iovec;
msg.msg_iovlen = 1;
msg.msg_control = msg_control;