appmenus: fix regexp for parsing received line

The '-' must be the last character. Otherwise it means character range.
In this case it was ')-_', which include '/', so path was incorrectly
sanitised.
This commit is contained in:
Marek Marczykowski-Górecki 2014-04-19 16:39:37 +02:00
parent 1483f009e6
commit 0afaa60093

View File

@ -88,8 +88,8 @@ def get_appmenus(vm):
row_no = 0 row_no = 0
appmenus = {} appmenus = {}
line_rx = re.compile(r"([a-zA-Z0-9.()-_]+.desktop):([a-zA-Z0-9-]+(?:\[[a-zA-Z@_]+\])?)=(.*)") line_rx = re.compile(r"([a-zA-Z0-9.()_-]+.desktop):([a-zA-Z0-9-]+(?:\[[a-zA-Z@_]+\])?)=(.*)")
ignore_rx = re.compile(r".*([a-zA-Z0-9.-_]+.desktop):(#.*|\s+)$") ignore_rx = re.compile(r".*([a-zA-Z0-9._-]+.desktop):(#.*|\s+)$")
for untrusted_line in untrusted_appmenulist: for untrusted_line in untrusted_appmenulist:
# Ignore blank lines and comments # Ignore blank lines and comments
if len(untrusted_line) == 0 or ignore_rx.match(untrusted_line): if len(untrusted_line) == 0 or ignore_rx.match(untrusted_line):