ref: 7fcc6aed753e23ccaf93a69020ac82e5acde36e5
parent: 5c5ffea92c87de9ccdde90dbca6fc345137ef9a6
author: Alex Musolino <alex@musolino.id.au>
date: Tue Nov 19 07:38:13 EST 2019
rio: fix bug causing short reads of wctl files Previously, reads of wctl files would return one byte less than requested as the returned string must be null terminated. Now we pass the actual size of the allocated buffer to the handler, which is large enough to accommodate a trailing partial rune and terminating null byte.
--- a/sys/src/cmd/rio/xfid.c
+++ b/sys/src/cmd/rio/xfid.c
@@ -670,9 +670,9 @@
}
c1 = crm.c1;
c2 = crm.c2;
- t = emalloc(cnt+UTFmax+1); /* room to unpack partial rune plus */
+ pair.ns = cnt+UTFmax+1; /* room for partial rune and null byte */
+ t = emalloc(pair.ns);
pair.s = t;
- pair.ns = cnt;
send(c1, &pair);
recv(c2, &pair);
fc.data = pair.s;
--
⑨