shithub: riscv

Download patch

ref: 28bcea12aa084166f75a51c68c44dbf74fae52e3
parent: 5d58b9573cc4ea97f569735c1a61be48c27e6728
author: cinap_lenrek <[email protected]>
date: Sun Feb 24 23:16:48 EST 2019

aux/wpa: fix %.*s format in debug prints

--- a/sys/src/cmd/aux/wpa.c
+++ b/sys/src/cmd/aux/wpa.c
@@ -915,7 +915,8 @@
 		eapresp(conn, 2, id, data, datalen);
 		return;
 	case 2:
-		fprint(2, "%s: eap error: %.*s\n", argv0, datalen-1, (char*)data+1);
+		fprint(2, "%s: eap error: %.*s\n",
+			argv0, utfnlen((char*)data+1, datalen-1), (char*)data+1);
 		return;
 	case 33:	/* EAP Extensions (AVP) */
 		if(debug)
@@ -971,7 +972,7 @@
 			if(debug || data[0] == 4)
 				fprint(2, "%s: eap mschapv2 %s: %.*s\n", argv0,
 					data[0] == 3 ? "Success" : "Failure",
-					datalen < 4 ? 0 : datalen-4, (char*)data+4);
+					datalen < 4 ? 0 : utfnlen((char*)data+4, datalen-4), (char*)data+4);
 			*(--data) = tp;
 			eapresp(conn, 2, id, data, 2);
 			return;