]> git.baikalelectronics.ru Git - uboot.git/commit
cmd/nvedit.c: Update input handling to cover overflow cases
authorTom Rini <trini@konsulko.com>
Tue, 26 Sep 2017 23:37:11 +0000 (19:37 -0400)
committerTom Rini <trini@konsulko.com>
Fri, 6 Oct 2017 15:28:21 +0000 (11:28 -0400)
commit66c5d135aaa32be1ae19bfdc8d8001a1068ce3e5
tree651a3afb5ee2a5526911108dfa41d5cc755f5b2e
parent698e25d40c9123ca26bbb829bd30d0edfe166bdb
cmd/nvedit.c: Update input handling to cover overflow cases

When we have multiple messages provided, we need to be sure that we do
not exceed the length of our 'message' buffer.  In the for loop, make
sure that pos is not larger than message.  Only copy in at most however
much of the message buffer remains.  Finally, if we have not reached the
end of the message buffer, put in a space and NULL, and if we have,
ensure the buffer is now NULL termined.

Reported-by: Coverity (CID: 165116)
Signed-off-by: Tom Rini <trini@konsulko.com>
cmd/nvedit.c