Protect against SQL insertion attacks in page move category update.
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 6 Aug 2004 19:17:49 +0000 (19:17 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 6 Aug 2004 19:17:49 +0000 (19:17 +0000)
includes/Title.php

index b224ad0..74c11c5 100644 (file)
@@ -902,7 +902,9 @@ class Title {
                # Fixing category links (those without piped 'alternate' names) to be sorted under the new title
                
                $dbw =& wfGetDB( DB_MASTER );
-               $sql = "UPDATE categorylinks SET cl_sortkey=\"" . $nt->getPrefixedText() . "\" WHERE cl_from=\"" .$this->getArticleID() . "\" AND cl_sortkey=\"" . $this->getPrefixedText() . "\"" ;
+               $sql = "UPDATE categorylinks SET cl_sortkey=" . $dbw->addQuotes( $nt->getPrefixedText() ) .
+                       " WHERE cl_from=" . $dbw->addQuotes( $this->getArticleID() ) .
+                       " AND cl_sortkey=" . $dbw->addQuotes( $this->getPrefixedText() );
                $dbw->query( $sql, "SpecialMovepage::doSubmit" );