/[packages]/updates/1/fail2ban/current/SOURCES/fail2ban-0.8.6-escape-matches.patch
ViewVC logotype

Contents of /updates/1/fail2ban/current/SOURCES/fail2ban-0.8.6-escape-matches.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 338254 - (show annotations) (download)
Thu Jan 3 16:35:19 2013 UTC (11 years, 3 months ago) by luigiwalser
File size: 1486 byte(s)
add upstream patch to fix CVE-2012-5642 (mga#8542)
1 diff --git a/server/action.py b/server/action.py
2 index faf5065..387c115 100644
3 --- a/server/action.py
4 +++ b/server/action.py
5 @@ -230,7 +230,14 @@ class Action:
6 def execActionStop(self):
7 stopCmd = Action.replaceTag(self.__actionStop, self.__cInfo)
8 return Action.executeCmd(stopCmd)
9 -
10 +
11 + def escapeTag(tag):
12 + for c in '\\#&;`|*?~<>^()[]{}$\n':
13 + if c in tag:
14 + tag = tag.replace(c, '\\' + c)
15 + return tag
16 + escapeTag = staticmethod(escapeTag)
17 +
18 ##
19 # Replaces tags in query with property values in aInfo.
20 #
21 @@ -243,8 +250,13 @@ class Action:
22 """ Replace tags in query
23 """
24 string = query
25 - for tag in aInfo:
26 - string = string.replace('<' + tag + '>', str(aInfo[tag]))
27 + for tag, value in aInfo.iteritems():
28 + value = str(value) # assure string
29 + if tag == 'matches':
30 + # That one needs to be escaped since its content is
31 + # out of our control
32 + value = escapeTag(value)
33 + string = string.replace('<' + tag + '>', value)
34 # New line
35 string = string.replace("<br>", '\n')
36 return string
37 diff --git a/server/action.py b/server/action.py
38 index 387c115..bd75033 100644
39 --- a/server/action.py
40 +++ b/server/action.py
41 @@ -255,7 +255,7 @@ class Action:
42 if tag == 'matches':
43 # That one needs to be escaped since its content is
44 # out of our control
45 - value = escapeTag(value)
46 + value = Action.escapeTag(value)
47 string = string.replace('<' + tag + '>', value)
48 # New line
49 string = string.replace("<br>", '\n')

  ViewVC Help
Powered by ViewVC 1.1.30