diff --git a/src/io.c b/src/io.c
index 2c6abc5ac9554996529b74ba4b6de1b09311e292..ee4f02806a84db796b806f3f245e6ab64a453e63 100644
--- a/src/io.c
+++ b/src/io.c
@@ -473,7 +473,7 @@ static void *ssl_read(void *arg)
 
 		if (tunnel->state == STATE_CONNECTING) {
 			if (packet_is_ip_plus_dns(packet)) {
-				char line[57]; // 1 + 15 + 7 + 15 + 2 + 15 + 1 + 1
+				char line[ARRAY_SIZE("[xxx.xxx.xxx.xxx], ns [xxx.xxx.xxx.xxx, xxx.xxx.xxx.xxx]")];
 
 				set_tunnel_ips(tunnel, packet);
 				strcpy(line, "[");
diff --git a/src/ipv4.c b/src/ipv4.c
index 037ddea74c7c0445043aff61f342ad9f29b9eaf5..fcc78a6beb3755a2de8962a1cd29256c19f492d3 100644
--- a/src/ipv4.c
+++ b/src/ipv4.c
@@ -1056,8 +1056,10 @@ int ipv4_add_nameservers_to_resolv_conf(struct tunnel *tunnel)
 	int ret = -1;
 	FILE *file;
 	struct stat stat;
-	char ns1[28], ns2[28]; // 11 + 15 + 1 + 1
-	char dns_suffix[MAX_DOMAIN_LENGTH+8];  // 7 + MAX_DOMAIN_LENGTH + 1
+	static const size_t NS_SIZE = ARRAY_SIZE("nameserver xxx.xxx.xxx.xxx");
+	char ns1[NS_SIZE], ns2[NS_SIZE];
+	static const size_t DNS_SUFFIX_SIZE = ARRAY_SIZE("search ") + MAX_DOMAIN_LENGTH;
+	char dns_suffix[DNS_SUFFIX_SIZE];
 	char *buffer = NULL;
 	int use_resolvconf = 0;
 
@@ -1254,8 +1256,10 @@ int ipv4_del_nameservers_from_resolv_conf(struct tunnel *tunnel)
 	int ret = -1;
 	FILE *file;
 	struct stat stat;
-	char ns1[27], ns2[27]; // 11 + 15 + 1
-	char dns_suffix[MAX_DOMAIN_LENGTH+8];  // 7 + MAX_DOMAIN_LENGTH + 1
+	static const size_t NS_SIZE = ARRAY_SIZE("nameserver xxx.xxx.xxx.xxx");
+	char ns1[NS_SIZE], ns2[NS_SIZE];
+	static const size_t DNS_SUFFIX_SIZE = ARRAY_SIZE("search ") + MAX_DOMAIN_LENGTH;
+	char dns_suffix[DNS_SUFFIX_SIZE];
 	char *buffer = NULL;
 	char *saveptr = NULL;
 
diff --git a/tests/lint/line_length.py b/tests/lint/line_length.py
index 9783910b1523709bd4cf7ee7e68b0fbc873570ff..3fc695f483131551486128225e559a1c68f1a511 100755
--- a/tests/lint/line_length.py
+++ b/tests/lint/line_length.py
@@ -39,7 +39,7 @@ def endswithstring(line):
         True if line ends with string, False otherwise.
 
     """
-    for end in ('"', '",', '");', '";', '" \\'):
+    for end in ('"', '",', '");', '";', '" \\', ')];'):
         if line.endswith(end):
             return True
     return False