From: rui guo Date: Wed, 24 Nov 2021 09:59:15 +0000 (+0800) Subject: log: System crash and reboot random when play any content on Netflix [1/1] X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=26c3fb14ad4fc50f0aec0196ce5adb19c00a21de;p=GitHub%2FLineageOS%2FG12%2Fandroid_hardware_amlogic_kernel-modules_optee.git 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 --- 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;