Fix possible DOS in konqueror (CVE-2009-2537)

pull/16/head
Francois Andriot 12 years ago committed by Slávek Banko
parent a67a48107f
commit 89cfde63b8

@ -62,6 +62,9 @@
#include <kdebug.h> #include <kdebug.h>
// CVE-2009-2537 (vendors agreed on max 10000 elements)
#define MAX_SELECT_LENGTH 10000
namespace KJS { namespace KJS {
KJS_DEFINE_PROTOTYPE_WITH_PROTOTYPE(HTMLDocumentProto, DOMDocumentProto) KJS_DEFINE_PROTOTYPE_WITH_PROTOTYPE(HTMLDocumentProto, DOMDocumentProto)
@ -2550,8 +2553,14 @@ void KJS::HTMLElement::putValueProperty(ExecState *exec, int token, const Value&
case SelectValue: { select.setValue(str); return; } case SelectValue: { select.setValue(str); return; }
case SelectLength: { // read-only according to the NS spec, but webpages need it writeable case SelectLength: { // read-only according to the NS spec, but webpages need it writeable
Object coll = Object::dynamicCast( getSelectHTMLCollection(exec, select.options(), select) ); Object coll = Object::dynamicCast( getSelectHTMLCollection(exec, select.options(), select) );
if ( coll.isValid() ) if ( coll.isValid() ) {
coll.put(exec,"length",value); if (value.toInteger(exec) >= MAX_SELECT_LENGTH) {
Object err = Error::create(exec, RangeError);
exec->setException(err);
} else {
coll.put(exec, "length", value);
}
}
return; return;
} }
// read-only: form // read-only: form

Loading…
Cancel
Save