Skip to content
Commit 175e4b01 authored by Heinrich Schuchardt's avatar Heinrich Schuchardt
Browse files

cmd: setexpr: fix printf_str()



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: f4f8d8bb ("cmd: setexpr: add format string handling")
Signed-off-by: default avatarHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: default avatarSimon Glass <sjg@chromium.org>
parent 976fb2ff
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment