]> git.ipfire.org Git - thirdparty/systemd.git/commit
udev-builtin-usb_id: Check full range of size returned by read()
authorFilipe Brandenburger <filbranden@google.com>
Thu, 7 Jun 2018 21:11:51 +0000 (14:11 -0700)
committerLennart Poettering <lennart@poettering.net>
Thu, 7 Jun 2018 22:46:44 +0000 (00:46 +0200)
commit9d635f50b8873ee62000b22af3763cb1ee89ae19
tree195fe0f045553ae762afd19d2bc3a725ca558687
parentfffafb2b5e521476bdd911ed0cc64909cfc0cf5f
udev-builtin-usb_id: Check full range of size returned by read()

This shouldn't be necessary, since read() should never return a size
larger than the size of the buffer passed in, but Coverity doesn't seem
to understand that.

We could possibly fix this with a model file for Coverity, but given
changing the code is not that much of a biggie, let's just do that
instead.

Fixes CID 996458: Overflowed or truncated value (or a value computed
from an overflowed or truncated value) `pos` used as array index.

Tested: `ninja -C build/ test`, builds without warnings, test cases pass.
src/udev/udev-builtin-usb_id.c