prevent xss attacks also if some javascript ends up in the alt-tag

This commit is contained in:
Bjoern Schiessle 2012-06-14 14:17:30 +02:00
parent 3e143601fe
commit df4737f52a
2 changed files with 3 additions and 2 deletions

View File

@ -84,7 +84,6 @@
}
title = selectedOpts.title || (obj.nodeName ? $(obj).attr('title') : obj.title) || '';
title = title.replace(/</, "&lt;").replace(/>/, "&gt;");
if (obj.nodeName && !selectedOpts.orig) {
selectedOpts.orig = $(obj).children("img:first").length ? $(obj).children("img:first") : $(obj);
@ -94,6 +93,8 @@
title = selectedOpts.orig.attr('alt');
}
title = title.replace(/</, "&lt;").replace(/>/, "&gt;");
href = selectedOpts.href || (obj.nodeName ? $(obj).attr('href') : obj.href) || null;
if ((/^(?:javascript)/i).test(href) || href == '#') {

File diff suppressed because one or more lines are too long