kernel: Increase +1 size of destination buffer to avoid overflow 65/320965/1 accepted/tizen/9.0/unified/20241129.021355
authorUnsung Lee <unsung.lee@samsung.com>
Fri, 22 Nov 2024 05:57:18 +0000 (14:57 +0900)
committerUnsung Lee <unsung.lee@samsung.com>
Tue, 26 Nov 2024 06:24:49 +0000 (15:24 +0900)
commit384b9691f690e5e00398f9626c44532df5f269d2
tree3b97137f76a75a50286a1eddcc97b8372aec40d6
parent4b7e21c94c446fd1995dc2f4ad715640d58cc79e
kernel: Increase +1 size of destination buffer to avoid overflow

Increase the size of the destination buffer to one more than the data to be copied through sscanf.
For example, if we want to copy BUFF_MAX size from source buffer
then destination buffer size should be larger than BUFF_MAX (e.g., BUFF_MAX + 1)
to avoid buffer overflow.
By doing so, regardless of the size of the source buffer,
only up to BUFF_MAX size is copied to the destination buffer.

Change-Id: I63cefd0f325d89fa41b6fe4241f871191c0884fa
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
src/util/kernel.c