From 26c3fb14ad4fc50f0aec0196ce5adb19c00a21de Mon Sep 17 00:00:00 2001 From: rui guo Date: Wed, 24 Nov 2021 17:59:15 +0800 Subject: [PATCH] log: System crash and reboot random when play any content on Netflix [1/1] PD#OTT-25875 Problem: detected buffer overflow in memcpy Solution: The parameter checking Verify: RDK + S905X4 Change-Id: I7d41111e58a7c4667e0c527890e41766970b840b Signed-off-by: rui guo --- optee/log.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/optee/log.c b/optee/log.c index 247f142..adf2bd0 100644 --- a/optee/log.c +++ b/optee/log.c @@ -159,6 +159,9 @@ static size_t log_print_text(char *buf, size_t size) if (size == 0) return 0; + /* Line_size Out-of-bounds check */ + text_size = text_size < (OPTEE_LOG_LINE_MAX - 16) ? text_size : OPTEE_LOG_LINE_MAX - 16; + do { const char *next = memchr(text, '\n', text_size); size_t line_size; -- 2.20.1