Reject data URIs for [img]
authorAlexander Ebert <ebert@woltlab.com>
Wed, 4 Oct 2017 22:45:24 +0000 (00:45 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 4 Oct 2017 22:45:24 +0000 (00:45 +0200)
wcfsetup/install/files/lib/system/html/metacode/converter/ImgMetacodeConverter.class.php

index d8e00bf6c4256aaf3ee8e5503b3d9cf4dd559c9b..8a1dfafa6595e9fb4060aefdad59c0ce3b1eeccf 100644 (file)
@@ -30,6 +30,15 @@ class ImgMetacodeConverter extends AbstractMetacodeConverter {
         */
        public function validateAttributes(array $attributes) {
                $count = count($attributes);
-               return ($count > 0 && $count < 4);
+               if ($count > 0 && $count < 4) {
+                       // reject data URIs
+                       if (preg_match('~^\s*data:~', $attributes[0])) {
+                               return false;
+                       }
+                       
+                       return true;
+               }
+               
+               return false;
        }
 }