Bug #8413: Fix regex to capture some malformed img tags
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 7 Jul 2009 21:57:30 +0000 (15:57 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 7 Jul 2009 21:57:30 +0000 (15:57 -0600)
imp/lib/Mime/Viewer/Html.php

index 9fe00ca..62313f0 100644 (file)
@@ -32,13 +32,13 @@ class IMP_Horde_Mime_Viewer_Html extends Horde_Mime_Viewer_Html
         # match 1
         (
             # <img> tags
-            <img[^>]+src=
+            <img[^>]+?src=
             # <input> tags
-            |<input[^>]*src=
+            |<input[^>]+?src=
             # "background" attributes
-            |<body[^>]*background=|<td[^>]*background=|<table[^>]*background=
+            |<body[^>]+?background=|<td[^>]*background=|<table[^>]*background=
             # "style" attributes; match 2; quotes: match 3
-            |(style=\s*("|\')?[^>]*background(?:-image)?:(?(3)[^"\']|[^>])*?url\s*\()
+            |(style=\s*("|\')?[^>]*?background(?:-image)?:(?(3)[^"\']|[^>])*?url\s*\()
         )
         # whitespace
         \s*
@@ -57,7 +57,7 @@ class IMP_Horde_Mime_Viewer_Html extends Horde_Mime_Viewer_Html
         (?(2)
             # closing parenthesis
             \s*\)
-            # remainder of the "style" attribute; match 5
+            # remainder of the "style" attribute; match 6
             ((?(3)[^"\'>]*|[^\s>]*))
         )
         /isx';