[KVE-2026-1638] 쇼핑몰 쿠폰 중복적용 취약점 수정
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> (cherry picked from commit 88bfddd0e83353c15c424549b594b8f36593220f)
This commit is contained in:
@@ -120,6 +120,11 @@ if($is_member) {
|
||||
for($i=0; $i<$it_cp_cnt; $i++) {
|
||||
$cid = isset($_POST['cp_id'][$i]) ? safe_replace_regex($_POST['cp_id'][$i], 'cp_id') : '';
|
||||
$it_id = isset($_POST['it_id'][$i]) ? safe_replace_regex($_POST['it_id'][$i], 'it_id') : '';
|
||||
|
||||
// 한 상품에는 상품쿠폰 하나만 적용 (동일 상품 반복 전송 무시)
|
||||
if(isset($arr_it_cp_prc[$it_id]))
|
||||
continue;
|
||||
|
||||
$sql = " select cp_id, cp_method, cp_target, cp_type, cp_price, cp_trunc, cp_minimum, cp_maximum
|
||||
from {$g5['g5_shop_coupon_table']}
|
||||
where cp_id = '$cid'
|
||||
@@ -774,11 +779,16 @@ $od_memo = nl2br(htmlspecialchars2(stripslashes($od_memo))) . " ";
|
||||
$coupon_duplicate = false;
|
||||
if($is_member) {
|
||||
$it_cp_cnt = (isset($_POST['cp_id']) && is_array($_POST['cp_id'])) ? count($_POST['cp_id']) : 0;
|
||||
$arr_it_cp_logged = array();
|
||||
for($i=0; $i<$it_cp_cnt; $i++) {
|
||||
$cid = isset($_POST['cp_id'][$i]) ? safe_replace_regex($_POST['cp_id'][$i], 'cp_id') : '';
|
||||
$cp_it_id = isset($_POST['it_id'][$i]) ? safe_replace_regex($_POST['it_id'][$i], 'it_id') : '';
|
||||
$cp_prc = isset($arr_it_cp_prc[$cp_it_id]) ? (int) $arr_it_cp_prc[$cp_it_id] : 0;
|
||||
|
||||
// 한 상품에는 상품쿠폰 하나만 기록 (동일 상품 반복 전송 무시)
|
||||
if(isset($arr_it_cp_logged[$cp_it_id]))
|
||||
continue;
|
||||
|
||||
if(trim($cid)) {
|
||||
// 쿠폰 이중사용 방지: INSERT 직전 재확인
|
||||
if(is_used_coupon($member['mb_id'], $cid)) {
|
||||
@@ -800,6 +810,8 @@ if($is_member) {
|
||||
$coupon_duplicate = true;
|
||||
break;
|
||||
}
|
||||
|
||||
$arr_it_cp_logged[$cp_it_id] = true;
|
||||
}
|
||||
|
||||
// 쿠폰사용금액 cart에 기록
|
||||
|
||||
Reference in New Issue
Block a user