]> git.ipfire.org Git - thirdparty/shadow.git/commit
lib/idmapping.c: Fix get_map_ranges range check
authorTobias Stoeckmann <tobias@stoeckmann.org>
Mon, 11 Nov 2024 19:28:52 +0000 (20:28 +0100)
committerAlejandro Colomar <alx@kernel.org>
Wed, 13 Nov 2024 17:17:03 +0000 (18:17 +0100)
commit929e61d604c4377be15bc27b88d82666e667720c
tree24e53e17548cb4c7648d0896a373436b502f9875
parent0b8c0c893c004b204ca55d303cc3b83a25f47019
lib/idmapping.c: Fix get_map_ranges range check

The get_map_ranges function shall support the whole accepted range
as specified in user_namespaces(7), i.e. upper and lower from 0 to
UINT_MAX - 1 as well as range from 1 to UINT_MAX. The actual limit of
range depends on values of upper and lower and adding the range
to either upper or lower shall never overflow UINT_MAX.

Fixes: 7c43eb2c4ea6 (2024-07-11, "lib/idmapping.c: get_map_ranges(): Move range check to a2ul() call")
Fixes: ff2baed5dbf8 (2016-08-14, "idmapping: add more checks for overflow")
Fixes: 94da3dc5c853 (2016-08-14, "also check upper for wrap")
Fixes: 7f5a14817d30 (2016-07-31, "get_map_ranges: check for overflow")
Co-authored-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/idmapping.c