tools/pygrub: Fix bug in LIMIT_FSIZE env variable override

The env variable must be interpreted as an integer. As it is, the override
logic simply causes an exception.

Fixes: e0342ae555 ("tools/pygrub: Deprivilege pygrub")
Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
This commit is contained in:
Alejandro Vallejo authored and Andrew Cooper committed 2023-11-23 17:21:01 +00:00
1 parent c789c7ff7e
commit de577641cf
1 file changed
+1 -1
+1 -1
View File
@@ -89,7 +89,7 @@ def downgrade_rlimits():
# write permissions are bound.
fsize = LIMIT_FSIZE
if "PYGRUB_MAX_FILE_SIZE_MB" in os.environ.keys():
fsize = os.environ["PYGRUB_MAX_FILE_SIZE_MB"] << 20
fsize = int(os.environ["PYGRUB_MAX_FILE_SIZE_MB"]) << 20
resource.setrlimit(resource.RLIMIT_FSIZE, (fsize, fsize))
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.