shithub: riscv

Download patch

ref: a37402be19e88395a17196b829cafebf5bdcb387
parent: 5ec91a6413dbf87a9fc0aa3e8038d81d2054bb0a
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Feb 24 22:41:10 EST 2019

nusb/audio: fix %.*s format usage

--- a/sys/src/cmd/nusb/audio/audio.c
+++ b/sys/src/cmd/nusb/audio/audio.c
@@ -122,7 +122,8 @@
 	char msg[256], *f[4];
 	int nf, speed;
 
-	snprint(msg, sizeof(msg), "%.*s", r->ifcall.count, r->ifcall.data);
+	snprint(msg, sizeof(msg), "%.*s",
+		utfnlen((char*)r->ifcall.data, r->ifcall.count), (char*)r->ifcall.data);
 	nf = tokenize(msg, f, nelem(f));
 	if(nf < 2){
 		respond(r, "invalid ctl message");