]> git.ipfire.org Git - thirdparty/systemd.git/commit
basic/fileio: simplify calculation of buffer size in read_full_virtual_file()
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 25 Mar 2021 10:58:35 +0000 (11:58 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 26 Mar 2021 14:46:44 +0000 (15:46 +0100)
commitca79564309e87f1cd92f7c79a03fccb792cca274
treef237e32b35549b66cdd93081b88a38be3ae3e2e6
parent91a96a564f5fc0dbad15f1c23a0fbda157a03558
basic/fileio: simplify calculation of buffer size in read_full_virtual_file()

We'd first assign a value up to SSIZE_MAX, and then immediately check if we
have a value bigger than READ_FULL_BYTES_MAX. This wasn't exactly wrong, but a
bit roundabout. Let's immediately assign the value from the appropriate range
or error out.

Coverity CID#1450973.
src/basic/fileio.c