summaryrefslogtreecommitdiff
path: root/sys/src/cmd/cwfs
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2015-09-26 11:41:31 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2015-09-26 11:41:31 +0200
commit76e0968e35f03ec848093072458e3d15bee2f372 (patch)
tree27f34d5e9f21446b7f00865b56b073bbb7a2a206 /sys/src/cmd/cwfs
parentfc06f637cff6d812207fb798b48a31ab463f0ab5 (diff)
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.
Diffstat (limited to 'sys/src/cmd/cwfs')
-rw-r--r--sys/src/cmd/cwfs/9p2.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/src/cmd/cwfs/9p2.c b/sys/src/cmd/cwfs/9p2.c
index d5f484987..6ead02645 100644
--- a/sys/src/cmd/cwfs/9p2.c
+++ b/sys/src/cmd/cwfs/9p2.c
@@ -93,7 +93,9 @@ mkdir9p2(Dir* dir, Dentry* dentry, void* strs)
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);