Index: sources/ipsclass.php
===================================================================
--- sources/ipsclass.php (revision 113)
+++ sources/ipsclass.php (revision 114)
@@ -2481,7 +2481,7 @@
{
foreach( $farray as $id => $stamp )
{
- $this->forum_read[$id] = $stamp;
+ $this->forum_read[ intval($id) ] = intval($stamp);
}
}
}
@@ -3517,7 +3517,31 @@
}
}
+ /*-------------------------------------------------------------------------*/
+ // Makes topics read or forum read cookie safe
/*-------------------------------------------------------------------------*/
+ /**
+ * Makes int based arrays safe
+ * XSS Fix: Ticket: 243603
+ * Problem with cookies allowing SQL code in keys
+ *
+ * @param array Array
+ * @return array Array (Cleaned)
+ * @since 2.1.4(A)
+ */
+ function clean_int_array( $array=array() )
+ {
+ $return = array();
+
+ foreach( $array as $k => $v )
+ {
+ $return[ intval($k) ] = intval($v);
+ }
+
+ return $return;
+ }
+
+ /*-------------------------------------------------------------------------*/
// Makes incoming info "safe"
/*-------------------------------------------------------------------------*/
Index: sources/action_public/topics.php
===================================================================
--- sources/action_public/topics.php (revision 113)
+++ sources/action_public/topics.php (revision 114)
@@ -2273,8 +2273,8 @@
if ( $read = $this->ipsclass->my_getcookie('topicsread') )
{
- $this->read_array = unserialize(stripslashes($read));
-
+ $this->read_array = $this->ipsclass->clean_int_array( unserialize(stripslashes($read)) );
+
if (! is_array($this->read_array) )
{
$this->read_array = array();
Index: sources/action_public/usercp.php
===================================================================
--- sources/action_public/usercp.php (revision 113)
+++ sources/action_public/usercp.php (revision 114)
@@ -3279,6 +3279,7 @@
arsort($topics);
$topic_array = array_slice( array_keys( $topics ), 0, 5 );
+ $topic_array = $this->ipsclass->clean_int_array( $topic_array );
if ( count( $topic_array ) )
{
Index: sources/action_public/search.php
===================================================================
--- sources/action_public/search.php (revision 113)
+++ sources/action_public/search.php (revision 114)
@@ -87,7 +87,7 @@
if ( $read = $this->ipsclass->my_getcookie('topicsread') )
{
- $this->read_array = unserialize(stripslashes($read));
+ $this->read_array = $this->ipsclass->clean_int_array( unserialize(stripslashes($read)) );
}
//-----------------------------------------
Index: sources/action_public/forums.php
===================================================================
--- sources/action_public/forums.php (revision 113)
+++ sources/action_public/forums.php (revision 114)
@@ -82,7 +82,7 @@
if ( $read = $this->ipsclass->my_getcookie('topicsread') )
{
- $this->read_array = unserialize(stripslashes($read));
+ $this->read_array = $this->ipsclass->clean_int_array( unserialize(stripslashes($read)) );
}
//-----------------------------------------