Userspace can handle determining the length by the return value.  Some
tools (e.g. GNU grep) don't like the \0 and think the contents are binary.

Signed-off-by: Barret Rhoden <b...@cs.berkeley.edu>
---
 kern/src/ns/util.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kern/src/ns/util.c b/kern/src/ns/util.c
index 71ab4cd91a31..4946be44fd21 100644
--- a/kern/src/ns/util.c
+++ b/kern/src/ns/util.c
@@ -47,8 +47,7 @@ int readnum_hex(unsigned long off, char *buf, unsigned long n,
 
 int readstr(unsigned long offset, char *buf, unsigned long n, const char *str)
 {
-       /* always include the \0 */
-       return readmem(offset, buf, n, str, strlen(str) + 1);
+       return readmem(offset, buf, n, str, strlen(str));
 }
 
 /* Helper: extracts a long from a user buffer (in text). */
-- 
2.19.0.605.g01d371f741-goog

-- 
You received this message because you are subscribed to the Google Groups 
"Akaros" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akaros+unsubscr...@googlegroups.com.
To post to this group, send email to akaros@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/akaros/20181002192529.228381-2-brho%40cs.berkeley.edu.
For more options, visit https://groups.google.com/d/optout.

Reply via email to