[PATCH 1/1] cmd: setexpr: fix printf_str()
Simon Glass
sjg at chromium.org
Tue Aug 22 20:56:33 CEST 2023
On Tue, 22 Aug 2023 at 04:21, Heinrich Schuchardt
<heinrich.schuchardt at canonical.com> wrote:
>
> If vsnprintf() returns a negative number, (i >= remaining) will
> possibly be true:
>
> 'i' is of type signed int and 'remaining' is of the unsigned type size_t.
> The C language will convert i to an unsigned type before the comparison.
>
> This can result in the wrong error type being indicated.
>
> Checking for negative i should be done first.
>
> Fixes: f4f8d8bb1abc ("cmd: setexpr: add format string handling")
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> ---
> cmd/printf.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
Reviewed-by: Simon Glass <sjg at chromium.org>
More information about the U-Boot
mailing list