mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-25 14:10:43 +00:00
tools: kwboot: Fix buffer overflow in kwboot_terminal()
The `in` variable is set to -1 in kwboot_terminal() if stdin is not a tty. In this case we should not look whether -1 is set in fd_set, for it can lead to a buffer overflow, which can be reproduced with echo "xyz" | ./tools/kwboot -t /dev/ttyUSB0 Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
This commit is contained in:
parent
3b5da64edf
commit
f30cb0d3b9
1 changed files with 1 additions and 1 deletions
|
@ -552,7 +552,7 @@ kwboot_terminal(int tty)
|
|||
break;
|
||||
}
|
||||
|
||||
if (FD_ISSET(in, &rfds)) {
|
||||
if (in >= 0 && FD_ISSET(in, &rfds)) {
|
||||
rc = kwboot_term_pipe(in, tty, quit, &s);
|
||||
if (rc)
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue