fix: get_member 함수에서 hook에 잘못된 아이디가 전달될 수 있는 문제 고침 (#328)

* fix: get_member 함수에서 hook에 잘못된 아이디가 전달될 수 있는 문제 고침

trim()이 mysql 쿼리에서만 처리되어 hook에 잘못된 회원아이디가 전달될 수 있는 문제.

* 잘못된 파라미터 타입 수정
This commit is contained in:
kkigomi
2024-06-18 09:45:34 +09:00
committed by GitHub
parent 9a1067862a
commit 02baf1589f

View File

@ -849,13 +849,23 @@ function get_group($gr_id, $is_cache=false)
} }
// 회원 정보를 얻는다. /**
* 회원 정보를 얻는다
*
* @param string $mb_id
* @param string $fields
* @param bool $is_cache
*
* @return array
*/
function get_member($mb_id, $fields = '*', $is_cache = false) function get_member($mb_id, $fields = '*', $is_cache = false)
{ {
global $g5; global $g5;
if (preg_match("/[^0-9a-z_]+/i", $mb_id)) $mb_id = trim($mb_id);
if (preg_match("/[^0-9a-z_]+/i", $mb_id)) {
return array(); return array();
}
static $cache = array(); static $cache = array();
@ -865,7 +875,7 @@ function get_member($mb_id, $fields='*', $is_cache=false)
return $cache[$mb_id][$key]; return $cache[$mb_id][$key];
} }
$sql = " select $fields from {$g5['member_table']} where mb_id = TRIM('$mb_id') "; $sql = " SELECT {$fields} from {$g5['member_table']} where mb_id = '{$mb_id}' ";
$cache[$mb_id][$key] = run_replace('get_member', sql_fetch($sql), $mb_id, $fields, $is_cache); $cache[$mb_id][$key] = run_replace('get_member', sql_fetch($sql), $mb_id, $fields, $is_cache);