Skip to content
This repository was archived by the owner on Jun 15, 2022. It is now read-only.

Commit ad22ec7

Browse files
committed
Add a couple esc_sql() calls to ensure filtered table names are safe
1 parent b818154 commit ad22ec7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

includes/class-wc-order-data-store-custom-table.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ public static function posts_join( $join, $wp_query ) {
566566
$join = preg_replace( $regex, '', $join );
567567
}
568568

569-
$table = wc_custom_order_table()->get_table_name();
569+
$table = esc_sql( wc_custom_order_table()->get_table_name() );
570570
$join .= " LEFT JOIN {$table} ON ( {$wpdb->posts}.ID = {$table}.order_id ) ";
571571

572572
// Don't necessarily apply this to subsequent posts_join filter callbacks.
@@ -590,7 +590,7 @@ public static function meta_query_where( $where, $wp_query ) {
590590
global $wpdb;
591591

592592
$meta_query = $wp_query->get( 'wc_order_meta_query' );
593-
$table = wc_custom_order_table()->get_table_name();
593+
$table = esc_sql( wc_custom_order_table()->get_table_name() );
594594

595595
if ( empty( $meta_query ) ) {
596596
return $where;
@@ -650,7 +650,7 @@ public static function filter_order_report_query( $query ) {
650650
'post_id' => false,
651651
'post_parent' => false,
652652
);
653-
$table = wc_custom_order_table()->get_table_name();
653+
$table = esc_sql( wc_custom_order_table()->get_table_name() );
654654
$replacements = array();
655655

656656
foreach ( $matches[0] as $key => $value ) {

0 commit comments

Comments
 (0)