Skip to content

Commit 096e24b

Browse files
Potential fix for code scanning alert no. 20: Incomplete multi-character sanitization (#1664)
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 24e28d5 commit 096e24b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

sourcefiles/modern/plugins/bootstrap-select/js/bootstrap-select.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,13 @@
722722
}
723723

724724
//strip all html-tags and trim the result
725-
this.$button.attr('title', $.trim(title.replace(/<[^>]*>?/g, '')));
725+
var sanitizedTitle = title;
726+
var prevSanitizedTitle;
727+
do {
728+
prevSanitizedTitle = sanitizedTitle;
729+
sanitizedTitle = sanitizedTitle.replace(/<[^>]*>?/g, '');
730+
} while (sanitizedTitle !== prevSanitizedTitle);
731+
this.$button.attr('title', $.trim(sanitizedTitle));
726732
this.$button.children('.filter-option').html(title);
727733

728734
this.$element.trigger('rendered.bs.select');

0 commit comments

Comments
 (0)