Skip to content

Commit ee05132

Browse files
committed
🔧 update regex for String.stripTags() to prevent regex DoS (prototypejs#349)
1 parent c1e14fc commit ee05132

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/prototype/lang/string.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ Object.extend(String.prototype, (function(){
288288
* // -> 'a link'
289289
**/
290290
function stripTags(){
291-
return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?(\/)?>|<\/\w+>/gi, '');
291+
return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>'"])+)?\s*("[^">]*|'[^'>])?(\/)?>|<\/\w+>/gi, '');
292292
}
293293

294294
/**

0 commit comments

Comments
 (0)