shithub: riscv

Download patch

ref: f18e8dfde88d00a19a184604865aa4d6383b16f5
parent: 0126f10d05933421a1db388368accd81578c9888
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Tue Sep 25 17:51:57 EDT 2018

ip/ipconfig: increase maximum host and domainname size to 255 bytes. idn for -h option

--- a/sys/src/cmd/ip/ipconfig/ipconfig.h
+++ b/sys/src/cmd/ip/ipconfig/ipconfig.h
@@ -54,8 +54,9 @@
 	ulong	xid;
 	ulong	starttime;
 	char	sname[64];
-	char	hostname[32];
-	char	domainname[64];
+	char	hostname[256];
+	char	domainname[256];
+	char	dnsdomain[256];
 	uchar	server[IPaddrlen];	/* server IP address */
 	ulong	offered;		/* offered lease time */
 	ulong	lease;			/* lease time */
@@ -87,8 +88,6 @@
 	uchar	autoflag;	/* flag: autonomous */
 	ulong	validlt;	/* valid lifetime (seconds) */
 	ulong	preflt;		/* preferred lifetime (seconds) */
-
-	char	dnsdomain[256];
 };
 
 struct Ctl
--- a/sys/src/cmd/ip/ipconfig/main.c
+++ b/sys/src/cmd/ip/ipconfig/main.c
@@ -350,7 +350,8 @@
 		plan9 = 0;
 		break;
 	case 'h':
-		snprint(conf.hostname, sizeof conf.hostname, "%s", EARGF(usage()));
+		if(utf2idn(EARGF(usage()), conf.hostname, sizeof(conf.hostname)) == nil)
+			sysfatal("bad hostname");
 		sendhostname = 1;
 		break;
 	case 'm':