[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH] lib/ukdebug: Fix buffer overrun in debug print routine



The printing routine miscalculated the amount of characters to print if
there were several newlines present in the buffer.

Signed-off-by: Florian Schmidt <florian.schmidt@xxxxxxxxx>
---
 lib/ukdebug/print.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ukdebug/print.c b/lib/ukdebug/print.c
index 9c70a81f..f43ab86e 100644
--- a/lib/ukdebug/print.c
+++ b/lib/ukdebug/print.c
@@ -179,7 +179,7 @@ static void _vprint(struct _vprint_console *cons,
 
                nlptr = memchr(lptr, '\n', len);
                if (nlptr) {
-                       llen = (int)((uintptr_t)nlptr - (uintptr_t)lbuf) + 1;
+                       llen = (int)((uintptr_t)nlptr - (uintptr_t)lptr) + 1;
                        cons->newline = 1;
                } else {
                        llen = len;
-- 
2.21.0


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.