shithub: riscv

Download patch

ref: 96d6f4433550c4e48c33d94f6e272fae4b4e4ffb
parent: 4de506404becf0e67f64e24685a52bcb9753146d
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Feb 24 23:22:03 EST 2019

wifi: fix %.*s format in wifictl

--- a/sys/src/9/port/wifi.c
+++ b/sys/src/9/port/wifi.c
@@ -921,7 +921,7 @@
 		return;
 	if(waserror())
 		return;
-	n = snprint(buf, sizeof(buf), "%.*s %q", (int)(p - opt), opt, p+1);
+	n = snprint(buf, sizeof(buf), "%.*s %q", utfnlen(opt, p - opt), opt, p+1);
 	wifictl(wifi, buf, n);
 	poperror();
 }
@@ -972,7 +972,7 @@
 		nexterror();
 	}
 	if(wifi->debug)
-		print("#l%d: wifictl: %.*s\n", wifi->ether->ctlrno, (int)n, buf);
+		print("#l%d: wifictl: %.*s\n", wifi->ether->ctlrno, utfnlen(buf, n), buf);
 	memmove(addr, wifi->ether->bcast, Eaddrlen);
 	wn = wifi->bss;
 	cb = parsecmd(buf, n);