From 66aa4af83611de2c59d9e8ab4ded1b48bec4a635 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 27 Jan 2016 18:04:50 +0100 Subject: Fix T47252: FileBrowser: buffer overflow with scripts defining too long 'filter_glob' string. Fixed this with three changes: * filter_glob is now 255 char max (63 could be a bit limited in some rare cases). * IO templates now explicitely define max len of that property (such that scripters are aware of the limit). * ED_fileselect_set_params() is now safe regarding too long strings from a 'filter_glob' op property. --- release/scripts/templates_py/operator_file_export.py | 1 + release/scripts/templates_py/operator_file_import.py | 1 + 2 files changed, 2 insertions(+) (limited to 'release/scripts/templates_py') diff --git a/release/scripts/templates_py/operator_file_export.py b/release/scripts/templates_py/operator_file_export.py index 9511cb163bc..38c88069845 100644 --- a/release/scripts/templates_py/operator_file_export.py +++ b/release/scripts/templates_py/operator_file_export.py @@ -28,6 +28,7 @@ class ExportSomeData(Operator, ExportHelper): filter_glob = StringProperty( default="*.txt", options={'HIDDEN'}, + maxlen=255, # Max internal buffer length, longer would be clamped. ) # List of operator properties, the attributes will be assigned diff --git a/release/scripts/templates_py/operator_file_import.py b/release/scripts/templates_py/operator_file_import.py index 9940a1b98eb..0ec57544f3d 100644 --- a/release/scripts/templates_py/operator_file_import.py +++ b/release/scripts/templates_py/operator_file_import.py @@ -31,6 +31,7 @@ class ImportSomeData(Operator, ImportHelper): filter_glob = StringProperty( default="*.txt", options={'HIDDEN'}, + maxlen=255, # Max internal buffer length, longer would be clamped. ) # List of operator properties, the attributes will be assigned -- cgit v1.2.3