From 83295ee74070aad3973cdcd8e57d85ad44efc3ce Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 20 Mar 2024 22:57:26 -0400 Subject: kernel: Require len in vcons_putstr() Signed-off-by: Ian Moffett --- sys/dev/vcons/vcons.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/vcons/vcons.c b/sys/dev/vcons/vcons.c index cba0b85..15e97e4 100644 --- a/sys/dev/vcons/vcons.c +++ b/sys/dev/vcons/vcons.c @@ -203,12 +203,12 @@ vcons_putch(struct vcons_screen *scr, char c) * @s: String to write. */ int -vcons_putstr(struct vcons_screen *scr, const char *s) +vcons_putstr(struct vcons_screen *scr, const char *s, size_t len) { int status; - while (*s != '\0') { - if ((status = vcons_putch(scr, *(s++))) != 0) { + for (size_t i = 0; i < len; ++i) { + if ((status = vcons_putch(scr, s[i])) != 0) { return status; } } -- cgit v1.2.3