Skip to content

Commit 08d60e5

Browse files
jognesspmladek
authored andcommitted
printk: fix string termination for record_print_text()
Commit f0e386e ("printk: fix buffer overflow potential for print_text()") added string termination in record_print_text(). However it used the wrong base pointer for adding the terminator. This led to a 0-byte being written somewhere beyond the buffer. Use the correct base pointer when adding the terminator. Fixes: f0e386e ("printk: fix buffer overflow potential for print_text()") Reported-by: Sven Schnelle <[email protected]> Signed-off-by: John Ogness <[email protected]> Signed-off-by: Petr Mladek <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent f0e386e commit 08d60e5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/printk/printk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,7 @@ static size_t record_print_text(struct printk_record *r, bool syslog,
13991399
* not counted in the return value.
14001400
*/
14011401
if (buf_size > 0)
1402-
text[len] = 0;
1402+
r->text_buf[len] = 0;
14031403

14041404
return len;
14051405
}

0 commit comments

Comments
 (0)