git: 9front

Download patch

ref: 7838cea9606d746e788320475f28531947d673ed
parent: 01cdd68de8a7e01425ca0dbd9e507d48e4313de7
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Sep 26 07:41:31 EDT 2015

cwfs: don't use sprint() to fill directory name

sprint() will replace invalid utf8 sequences with U+FFFD
which caused directory reads and stats to return the wrong
filename. just strcpy the name bytes.

--- a/sys/src/cmd/cwfs/9p2.c
+++ b/sys/src/cmd/cwfs/9p2.c
@@ -93,7 +93,9 @@
 
 	op = p = strs;
 	dir->name = p;
-	p += sprint(p, "%s", dentry->name)+1;
+	strncpy(p, dentry->name, NAMELEN);
+	p[NAMELEN-1] = 0;
+	p += strlen(p)+1;
 
 	dir->uid = p;
 	uidtostr(p, dentry->uid, 1);
--