ref: 05f6c08985c9bd522e0a938f0e90b20df3f6792d
parent: 347303b136c41ac5ca4408818fdd1a3fde89888a
author: cinap_lenrek <[email protected]>
date: Tue Sep 25 16:28:19 EDT 2018
ip/dhcp6d: handle internationalized domain names
--- a/sys/src/cmd/ip/dhcp6d.c
+++ b/sys/src/cmd/ip/dhcp6d.c
@@ -562,6 +562,7 @@
static int
odomainlist(uchar *w, int n, Otab *o, Req *q)
{
+ char val[256];
Ndbtuple *t;
int l, r;
char *s;
@@ -570,7 +571,9 @@
for(t = q->t; t != nil; t = t->entry){
if(strcmp(t->attr, o->q[0]) != 0)
continue;
- for(s = t->val; *s != 0; s++){
+ if(utf2idn(t->val, val, sizeof(val)) == nil)
+ continue;
+ for(s = val; *s != 0; s++){
for(l = 0; *s != 0 && *s != '.'; l++)
s++;
if(r+1+l > n)
@@ -578,6 +581,8 @@
w[r++] = l;
memmove(w+r, s-l, l);
r += l;
+ if(*s != '.')
+ break;
}
if(r >= n)
return -1;