diff options
Diffstat (limited to 'src/libs6dns/s6dns_hosts_compile.c')
-rw-r--r-- | src/libs6dns/s6dns_hosts_compile.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/libs6dns/s6dns_hosts_compile.c b/src/libs6dns/s6dns_hosts_compile.c index 852ce20..cf3e304 100644 --- a/src/libs6dns/s6dns_hosts_compile.c +++ b/src/libs6dns/s6dns_hosts_compile.c @@ -144,7 +144,7 @@ static void *byipv6_dtok (uint32_t d, void *aux) static inline uint8_t cclass (char c) { - static uint8_t const ctable[128] = "09999999913111999999999999999999199999999999945977777777776999999888888888888888888888888889999898888888888888888888888888899999" ; + static uint8_t const ctable[128] = "09999999913111999999999999999999199299999999945977777777776999999888888888888888888888888889999898888888888888888888888888899999" ; return c & 0x80 ? 9 : ctable[(uint8_t)c] - '0' ; } @@ -152,18 +152,18 @@ static int s6dns_hosts_parse (buffer *b, hostdata *hd) { static uint8_t const table[6][10] = { - { 0x06, 0x00, 0x01, 0x00, 0x07, 0x07, 0x0a, 0x0a, 0x0a, 0x07 }, - { 0x06, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, - { 0x16, 0x13, 0x07, 0x10, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x07 }, - { 0x06, 0x03, 0x01, 0x00, 0x07, 0x07, 0x07, 0x07, 0x0c, 0x07 }, - { 0x26, 0x64, 0x07, 0x20, 0x0c, 0x0c, 0x07, 0x0c, 0x0c, 0x07 }, - { 0x06, 0x05, 0x01, 0x00, 0x07, 0x07, 0x07, 0x07, 0x0c, 0x07 } + { 0x0a, 0x00, 0x01, 0x00, 0x0b, 0x0b, 0x12, 0x12, 0x12, 0x0b }, + { 0x0a, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, + { 0x2a, 0x23, 0x0b, 0x20, 0x0b, 0x12, 0x12, 0x12, 0x12, 0x0b }, + { 0x0a, 0x03, 0x01, 0x00, 0x0b, 0x0b, 0x0b, 0x0b, 0x14, 0x0b }, + { 0x4a, 0xc4, 0x0b, 0x40, 0x14, 0x14, 0x0b, 0x14, 0x14, 0x0b }, + { 0x0a, 0x05, 0x01, 0x00, 0x0b, 0x0b, 0x0b, 0x0b, 0x14, 0x0b } } ; node_ip *node = 0 ; size_t mark = hd->storage.len ; uint8_t flags = 0 ; uint8_t state = 0 ; - while (state < 0x06) + while (state < 0x0a) { uint8_t c ; char cur ; @@ -171,9 +171,9 @@ static int s6dns_hosts_parse (buffer *b, hostdata *hd) if (r == -1) goto err ; if (!r) cur = 0 ; c = table[state][cclass(cur)] ; - state = c & 0x07 ; - if (c & 0x08) if (!stralloc_catb(&hd->storage, &cur, 1)) goto err ; - if (c & 0x10) + state = c & 0x0f ; + if (c & 0x10) if (!stralloc_catb(&hd->storage, &cur, 1)) goto err ; + if (c & 0x20) { char ip[16] ; if (!stralloc_0(&hd->storage)) goto err ; @@ -207,7 +207,7 @@ static int s6dns_hosts_parse (buffer *b, hostdata *hd) hd->storage.len = mark ; flags &= ~2 ; } - if (c & 0x20) + if (c & 0x40) { node_name *noden ; size_t i = 0 ; @@ -262,9 +262,9 @@ static int s6dns_hosts_parse (buffer *b, hostdata *hd) } mark = hd->storage.len ; } - if (c & 0x40) flags |= 2 ; + if (c & 0x80) flags |= 2 ; } - if (state > 0x06) return (errno = EILSEQ, 0) ; + if (state > 0x0a) return (errno = EILSEQ, 0) ; return 1 ; err: |