Adam Tkac ed1045
diff -up bind-9.5.0b1/bin/dig/dighost.c.libidn3 bind-9.5.0b1/bin/dig/dighost.c
Adam Tkac ed1045
--- bind-9.5.0b1/bin/dig/dighost.c.libidn3	2007-12-20 13:24:27.000000000 +0100
Adam Tkac ed1045
+++ bind-9.5.0b1/bin/dig/dighost.c	2007-12-20 13:27:10.000000000 +0100
Adam Tkac ed1045
@@ -1859,10 +1859,13 @@ setup_lookup(dig_lookup_t *lookup) {
Adam Tkac ed1045
 	if (lookup->origin != NULL) {
Adam Tkac ed1045
 		result = libidn_locale_to_utf8 (lookup->origin->origin, utf8_str);
Adam Tkac ed1045
 		check_result (result, "convert origin to UTF-8");
Adam Tkac ed1045
-		if (len + strlen (utf8_str) < MXNAME)
Adam Tkac ed1045
-			(void) strcpy (utf8_name + len, utf8_str);
Adam Tkac ed1045
-		else
Adam Tkac ed1045
-			fatal ("Too long name + origin");
Adam Tkac ed1045
+		if (len > 0 && utf8_name[len - 1] != '.') {
Adam Tkac ed1045
+			utf8_name[len++] = '.';
Adam Tkac ed1045
+			if (len + strlen (utf8_str) < MXNAME)
Adam Tkac ed1045
+				(void) strcpy (utf8_name + len, utf8_str);
Adam Tkac ed1045
+			else
Adam Tkac ed1045
+				fatal ("Too long name + origin");
Adam Tkac ed1045
+		}
Adam Tkac ed1045
 	}
Adam Tkac ed1045
 
Adam Tkac ed1045
 	result = libidn_utf8_to_ascii (utf8_name, ascii_name);