diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libs6dns/s6dns_domain_tostring.c | 2 | ||||
-rw-r--r-- | src/libs6dns/s6dns_engine.c | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/libs6dns/s6dns_domain_tostring.c b/src/libs6dns/s6dns_domain_tostring.c index e11715b..2c1cf01 100644 --- a/src/libs6dns/s6dns_domain_tostring.c +++ b/src/libs6dns/s6dns_domain_tostring.c @@ -11,11 +11,13 @@ unsigned int s6dns_domain_tostring (char *s, size_t max, s6dns_domain_t const *d if (d->len == 1) { s[0] = '.' ; + s[1] = 0 ; return 1 ; } else { memcpy(s, d->s + 1, d->len - 1) ; + s[d->len - 1] = 0 ; return d->len - 1 ; } } diff --git a/src/libs6dns/s6dns_engine.c b/src/libs6dns/s6dns_engine.c index 75b41cc..7f20d73 100644 --- a/src/libs6dns/s6dns_engine.c +++ b/src/libs6dns/s6dns_engine.c @@ -5,6 +5,9 @@ #include <strings.h> #include <stdint.h> #include <errno.h> +#ifdef DEBUG +#include <stdlib.h> +#endif #include <skalibs/posixishard.h> #include <skalibs/uint16.h> @@ -396,6 +399,9 @@ int s6dns_engine_init_r (s6dns_engine_t *dt, s6dns_ip46list_t const *servers, ui memcpy(dt->sa.s + 14, q, qlen) ; uint16_pack_big(dt->sa.s + 14 + qlen, qtype) ; uint16_pack_big(dt->sa.s + 16 + qlen, S6DNS_C_IN) ; +#ifdef DEBUG + if (getenv("S6DNS_FORCE_TCP")) dt->flagtcp = 1 ; else +#endif if (qlen > 496) dt->flagtcp = 1 ; else { |