Changeset 941

Show
Ignore:
Timestamp:
04/10/07 21:37:34 (1 year ago)
Author:
Neal
Message:

Prevented some possible path disclosures.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/upload/admin_categories.php

    r934 r941  
    152152                        message('You must enter a category name.'); 
    153153 
    154                 if (!preg_match('#^\d+$#', $cat_order[$i])) 
     154                if (!@preg_match('#^\d+$#', $cat_order[$i])) 
    155155                        message('Position must be an integer value.'); 
    156156 
  • trunk/upload/admin_forums.php

    r600 r941  
    138138        while (list($forum_id, $disp_position) = @each($_POST['position'])) 
    139139        { 
    140                 if (!preg_match('#^\d+$#', $disp_position)) 
     140                if (!@preg_match('#^\d+$#', $disp_position)) 
    141141                        message('Position must be a positive integer value.'); 
    142142 
  • trunk/upload/admin_loader.php

    r100 r941  
    3838// The plugin to load should be supplied via GET 
    3939$plugin = isset($_GET['plugin']) ? $_GET['plugin'] : ''; 
    40 if (!preg_match('/^AM?P_(\w*?)\.php$/i', $plugin)) 
     40if (!@preg_match('/^AM?P_(\w*?)\.php$/i', $plugin)) 
    4141        message($lang_common['Bad request']); 
    4242 
  • trunk/upload/admin_prune.php

    r214 r941  
    8585 
    8686        $prune_days = $_POST['req_prune_days']; 
    87         if (!preg_match('#^\d+$#', $prune_days)) 
     87        if (!@preg_match('#^\d+$#', $prune_days)) 
    8888                message('Days to prune must be a positive integer.'); 
    8989 
  • trunk/upload/admin_ranks.php

    r858 r941  
    4747                message('You must enter a rank title.'); 
    4848 
    49         if (!preg_match('#^\d+$#', $min_posts)) 
     49        if (!@preg_match('#^\d+$#', $min_posts)) 
    5050                message('Minimum posts must be a positive integer value.'); 
    5151 
     
    7878                message('You must enter a rank title.'); 
    7979 
    80         if (!preg_match('#^\d+$#', $min_posts)) 
     80        if (!@preg_match('#^\d+$#', $min_posts)) 
    8181                message('Minimum posts must be a positive integer value.'); 
    8282 
  • trunk/upload/admin_users.php

    r600 r941  
    112112        $ip = $_GET['show_users']; 
    113113 
    114         if (!preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $ip)) 
     114        if (!@preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $ip)) 
    115115                message('The supplied IP address is not correctly formatted.'); 
    116116 
  • trunk/upload/include/dblayer/mysql.php

    r2 r941  
    157157        function escape($str) 
    158158        { 
    159                 if (function_exists('mysql_real_escape_string')) 
     159                if (is_array($str)) 
     160                        return ''; 
     161                else if (function_exists('mysql_real_escape_string')) 
    160162                        return mysql_real_escape_string($str, $this->link_id); 
    161163                else 
  • trunk/upload/include/dblayer/mysqli.php

    r2 r941  
    160160        function escape($str) 
    161161        { 
    162                 return mysqli_real_escape_string($this->link_id, $str); 
     162                return is_array($str) ? '' : mysqli_real_escape_string($this->link_id, $str); 
    163163        } 
    164164 
  • trunk/upload/include/dblayer/pgsql.php

    r58 r941  
    218218        function escape($str) 
    219219        { 
    220                 return pg_escape_string($str); 
     220                return is_array($str) ? '' : pg_escape_string($str); 
    221221        } 
    222222 
  • trunk/upload/include/dblayer/sqlite.php

    r58 r941  
    220220        function escape($str) 
    221221        { 
    222                 return sqlite_escape_string($str); 
     222                return is_array($str) ? '' : sqlite_escape_string($str); 
    223223        } 
    224224 
  • trunk/upload/moderate.php

    r931 r941  
    3636 
    3737        // Is get_host an IP address or a post ID? 
    38         if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $_GET['get_host'])) 
     38        if (@preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $_GET['get_host'])) 
    3939                $ip = $_GET['get_host']; 
    4040        else 
     
    9999                        confirm_referrer('moderate.php'); 
    100100 
    101                         if (preg_match('/[^0-9,]/', $posts)) 
     101                        if (@preg_match('/[^0-9,]/', $posts)) 
    102102                                message($lang_common['Bad request']); 
    103103 
     
    288288                confirm_referrer('moderate.php'); 
    289289 
    290                 if (preg_match('/[^0-9,]/', $_POST['topics'])) 
     290                if (@preg_match('/[^0-9,]/', $_POST['topics'])) 
    291291                        message($lang_common['Bad request']); 
    292292 
     
    413413                confirm_referrer('moderate.php'); 
    414414 
    415                 if (preg_match('/[^0-9,]/', $topics)) 
     415                if (@preg_match('/[^0-9,]/', $topics)) 
    416416                        message($lang_common['Bad request']); 
    417417 
  • trunk/upload/profile.php

    r940 r941  
    764764 
    765765                        // If the ICQ UIN contains anything other than digits it's invalid 
    766                         if ($form['icq'] != '' && preg_match('/[^0-9]/', $form['icq'])) 
     766                        if ($form['icq'] != '' && @preg_match('/[^0-9]/', $form['icq'])) 
    767767                                message($lang_prof_reg['Bad ICQ']); 
    768768 
  • trunk/upload/userlist.php

    r432 r941  
    4242$show_post_count = ($pun_config['o_show_post_count'] == '1' || $pun_user['g_id'] < PUN_GUEST) ? true : false; 
    4343 
    44 $username = (isset($_GET['username']) && $pun_user['g_search_users'] == '1') ? $_GET['username'] : ''; 
     44$username = (isset($_GET['username']) && $pun_user['g_search_users'] == '1') ? pun_trim($_GET['username']) : ''; 
    4545$show_group = (!isset($_GET['show_group']) || intval($_GET['show_group']) < -1 && intval($_GET['show_group']) > 2) ? -1 : intval($_GET['show_group']); 
    4646$sort_by = (!isset($_GET['sort_by']) || $_GET['sort_by'] != 'username' && $_GET['sort_by'] != 'registered' && ($_GET['sort_by'] != 'num_posts' || !$show_post_count)) ? 'username' : $_GET['sort_by'];