aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-05-23 19:01:30 -0400
committerIan Moffett <ian@osmora.org>2024-05-23 19:01:30 -0400
commit5f27480f26cb3c3329fdf4f1d7047ee11c6d1a95 (patch)
tree1a98fc44e8a76f3e92b9c24576e657bd080338f0
parentb1a06957509fb5e9c306efa0eb27f2071c9663a6 (diff)
kernel: intr: Fix garbage output
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r--sys/kern/kern_intr.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c
index e37c87e..0c80334 100644
--- a/sys/kern/kern_intr.c
+++ b/sys/kern/kern_intr.c
@@ -65,9 +65,15 @@ proc_read(struct proc_entry *entry, struct sio_txn *sio)
idx += res;
p += res;
}
+
+ if (idx >= (PROC_BUF_SIZE - 1)) {
+ break;
+ }
}
- len = strlen(buf);
+ len = idx + 1;
+ buf[idx] = '\0';
+
if (sio->len > PROC_BUF_SIZE)
sio->len = PROC_BUF_SIZE;
if (len > sio->len)
@@ -75,7 +81,7 @@ proc_read(struct proc_entry *entry, struct sio_txn *sio)
memcpy(sio->buf, buf, len);
mutex_release(&intrlist_lock);
- return sio->len;
+ return len;
}
/*