Heinrich Schuchardt 27380d885d console: file should always be non-negative
We use the parameter file in console functions to choose from an array
after checking against MAX_FILES but we never check if the value of file
is negative.

Running ./u-boot -T -l and issuing the poweroff command has resulted in
crashes because os_exit() results in std::ostream::flush() calling U-Boot's
fflush with file being a pointer which when converted to int may be
represented by a negative number.

This shows that checking against MAX_FILES is not enough. We have to ensure
that the file argument is always positive.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-02 19:17:24 +01:00
..
2022-10-31 11:02:44 -04:00
2022-07-26 02:30:56 -06:00
2022-01-19 18:11:34 +01:00
2022-11-02 08:42:03 +01:00
2022-01-19 18:11:34 +01:00
2022-10-31 14:47:32 -04:00
2022-10-30 20:07:17 +01:00
2022-08-04 16:18:47 -04:00
2022-01-19 18:11:34 +01:00
2022-10-31 11:04:00 -04:00
2022-10-30 20:07:17 +01:00
2021-04-12 17:44:55 -04:00
2021-04-20 07:31:12 -04:00
2022-08-04 16:18:47 -04:00