]> git.dujemihanovic.xyz Git - u-boot.git/commit
stdio: fix stdio_deregister_dev()
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Fri, 29 Sep 2023 00:47:17 +0000 (02:47 +0200)
committerTom Rini <trini@konsulko.com>
Mon, 9 Oct 2023 19:24:31 +0000 (15:24 -0400)
commit6da11cc81ea773d9a1e3059da311c6f2e2aeb6ef
treef263b4f7a655ae63af68784be4dd834858a8095c
parent6a1e0ae43e2108a88e022103b3b303c9f4964a64
stdio: fix stdio_deregister_dev()

When copying the name of a stdio device we must ensure that it is NUL
terminated before passing it to strcmp() to avoid a buffer overrun.

Truncating the name field leads to failure to deregister a stdio device.
When copying we must ensure that the name field sizes match.

Addresses-Coverity-ID: 350462 String not null terminated
Fixes: 5294e97832a6 ("stdio: extend "name" to 32 symbols")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
common/stdio.c
include/stdio_dev.h