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 <pingou@pingoured.fr>
This commit is contained in:
parent
65b98448c6
commit
407bb73a12
1 changed files with 2 additions and 1 deletions
3
tools/osbuild-mpp
Normal file → Executable file
3
tools/osbuild-mpp
Normal file → Executable file
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue