Verify sizes before arithmetic operations
authortobias <tobias@openbsd.org>
Sat, 23 Apr 2022 08:57:52 +0000 (08:57 +0000)
committertobias <tobias@openbsd.org>
Sat, 23 Apr 2022 08:57:52 +0000 (08:57 +0000)
commitc1a45aed656e7d5627c30c92421893a76f370ccb
treee29113a1adfd0c22b39dc999548f9f13ac785963
parenta4df3dbd08693a245b2a1878ca6e3e9419411c50
Verify sizes before arithmetic operations

Unsigned overflows are not a bug in C but we have to make sure that
requested buffer sizes will be actually available.

If not, set errno to ERANGE and return an error value.

ok deraadt, millert
lib/libutil/imsg-buffer.c
regress/lib/libutil/Makefile
regress/lib/libutil/imsg/Makefile [new file with mode: 0644]
regress/lib/libutil/imsg/ibuf_test.c [new file with mode: 0644]