From 407bb73a126ff70b150d698fe86cda06ea81d14d Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Tue, 14 Sep 2021 11:19:42 +0200 Subject: [PATCH] Copy the local_vars dictionary to avoid eval modifying it This avoid having the local_vars dictionary getting filled with a large number of built-in variable that are of no use for this dictionary. This commit was created by from Alexander Larsson. Signed-off-by: Pierre-Yves Chibon --- tools/osbuild-mpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) mode change 100644 => 100755 tools/osbuild-mpp diff --git a/tools/osbuild-mpp b/tools/osbuild-mpp old mode 100644 new mode 100755 index 60a03cc4..c74a76c8 --- a/tools/osbuild-mpp +++ b/tools/osbuild-mpp @@ -689,7 +689,8 @@ class ManifestFile: format_string = node["mpp-format-int"] # pylint: disable=eval-used # yolo this is fine! - res = eval(f'f\'\'\'{format_string}\'\'\'', local_vars) + # Note, we copy local_vars here to avoid eval modifying it + res = eval(f'f\'\'\'{format_string}\'\'\'', dict(local_vars)) if res_type == "int": return int(res)