From 3e3729d35fb6fdea7c7a70778d61b830340ad8d6 Mon Sep 17 00:00:00 2001 From: Ritjaina Date: Fri, 23 Jun 2017 06:30:33 -0600 Subject: [PATCH] netdb: Fixed buffer size used for sending DNS queries should depend on the configured DNS name size. --- libc/netdb/lib_dnsquery.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libc/netdb/lib_dnsquery.c b/libc/netdb/lib_dnsquery.c index 59196206b6..073ff7ee13 100644 --- a/libc/netdb/lib_dnsquery.c +++ b/libc/netdb/lib_dnsquery.c @@ -64,9 +64,14 @@ #define MAX_RETRIES 8 -/* Buffer sizes */ +/* Buffer sizes + * + * The SEND_BUFFER_SIZE depends the configured DNS name size, + * sizeof(DNS query0 = Header (12 bytes) + DNS Name (Variable) + + * Query type (2 bytes) + Query Class (2 bytes) + */ -#define SEND_BUFFER_SIZE 64 +#define SEND_BUFFER_SIZE (32 + CONFIG_NETDB_DNSCLIENT_NAMESIZE) #define RECV_BUFFER_SIZE CONFIG_NETDB_DNSCLIENT_MAXRESPONSE /****************************************************************************