shithub: riscv

Download patch

ref: cb8ef42b5579155a34fd7672c867a9e06e2983dd
parent: b01b637889b587521b2f616ea469b3b64e0a7a9b
author: cinap_lenrek <[email protected]>
date: Sun Feb 24 22:51:19 EST 2019

ip/pppoe: fix %.*s format in debug prints

--- a/sys/src/cmd/ip/pppoe.c
+++ b/sys/src/cmd/ip/pppoe.c
@@ -614,10 +614,10 @@
 			fprint(2, "end of tag list\n");
 			break;
 		case TagSrvName:
-			fprint(2, "service '%.*s'\n", len, (char*)v);
+			fprint(2, "service '%.*s'\n", utfnlen((char*)v, len), (char*)v);
 			break;
 		case TagAcName:
-			fprint(2, "ac '%.*s'\n", len, (char*)v);
+			fprint(2, "ac '%.*s'\n", utfnlen((char*)v, len), (char*)v);
 			break;
 		case TagHostUniq:
 			fprint(2, "nonce ");
@@ -636,10 +636,10 @@
 			fprint(2, "relay ");
 			goto Hex;
 		case TagSrvNameErr:
-			fprint(2, "srverr '%.*s'\n", len, (char*)v);
+			fprint(2, "srverr '%.*s'\n", utfnlen((char*)v, len), (char*)v);
 			break;
 		case TagAcSysErr:
-			fprint(2, "syserr '%.*s'\n", len, (char*)v);
+			fprint(2, "syserr '%.*s'\n", utfnlen((char*)v, len), (char*)v);
 			break;
 		}
 		sz += 2+2+len;