diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 807810216492adde27353ad3d46fc819a4d9c100..aafec8cb8637dff040260e7f4ce9a0618d5f0489 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1445,7 +1445,7 @@ static size_t record_print_text(struct printk_record *r, bool syslog,
 	 * not counted in the return value.
 	 */
 	if (buf_size > 0)
-		text[len] = 0;
+		r->text_buf[len] = 0;
 
 	return len;
 }