summaryrefslogtreecommitdiff
path: root/src/dnsstub/dns_rcrw.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dnsstub/dns_rcrw.c')
-rw-r--r--src/dnsstub/dns_rcrw.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/dnsstub/dns_rcrw.c b/src/dnsstub/dns_rcrw.c
index 8c15591..95239a2 100644
--- a/src/dnsstub/dns_rcrw.c
+++ b/src/dnsstub/dns_rcrw.c
@@ -8,10 +8,10 @@
#include "taia.h"
/**
- @file dns_rcrw.c
- @author djb
- @source ucspi-tcp
- @brief DNS receive rewrite
+ @file dns_rcrw.c
+ @author djb
+ @source ucspi-tcp
+ @brief DNS receive rewrite
*/
static stralloc data = {0};
@@ -56,12 +56,13 @@ static int init(stralloc *rules)
if (!stralloc_append(&data, " ")) return DNS_MEM;
if (!stralloc_copys(rules, "?:")) return DNS_MEM;
i = 0;
- for (j = 0; j < data.len; ++j)
+ for (j = 0; j < data.len; ++j) {
if (data.s[j] == ' ') {
if (!stralloc_cats(rules, "+.")) return DNS_MEM;
if (!stralloc_catb(rules, data.s + i, j - i)) return DNS_MEM;
i = j + 1;
}
+ }
if (!stralloc_0(rules)) return DNS_MEM;
if (!stralloc_cats(rules, "*.:")) return DNS_MEM;
if (!stralloc_0(rules)) return DNS_MEM;
@@ -74,7 +75,7 @@ static int init(stralloc *rules)
if (i) {
if (!stralloc_append(&data, "\n")) return DNS_MEM;
i = 0;
- for (j = 0; j < data.len; ++j)
+ for (j = 0; j < data.len; ++j) {
if (data.s[j] == '\n') {
if (byte_equal("search ", 7, data.s + i) || byte_equal("search\t", 7, data.s + i)
|| byte_equal("domain ", 7, data.s + i) || byte_equal("domain\t", 7, data.s + i))
@@ -99,6 +100,7 @@ static int init(stralloc *rules)
}
i = j + 1;
}
+ }
}
host[0] = 0;