Skip to content

Commit d08d647

Browse files
authored
Merge pull request #196 from PRX/queries_db
Escape slug when doing cusotm queries
2 parents a96810f + e6f40ff commit d08d647

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

wp-content/plugins/tw-endpoint-helper/tw-endpoint-helper.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ function _peh_get_object_by_wp_migrated_legacy_redirect_db( $slug ) {
319319

320320
global $wpdb;
321321

322-
$row = $wpdb->get_row( "SELECT `uid` AS `id`, `type`, `redirect` FROM `wp_migrated_legacy_redirect` WHERE `source` = '$slug' LIMIT 1;" );
322+
$row = $wpdb->get_row( $wpdb->prepare( "SELECT `uid` AS `id`, `type`, `redirect` FROM `wp_migrated_legacy_redirect` WHERE `source` = '%s' LIMIT 1;", $slug ) );
323323
if ( isset( $row->type ) && 'redirect' === $row->type && wp_http_validate_url( $row->redirect ) ) {
324324
$row->is_external = true;
325325
} elseif( $row && isset( $row->redirect ) && $row->redirect ) {
@@ -349,7 +349,7 @@ function _peh_get_object_by_wp_migrated_legacy_alias_db( $slug ) {
349349

350350
global $wpdb;
351351

352-
$row = $wpdb->get_row( "SELECT `source`, `alias` FROM `wp_migrated_legacy_url_alias` WHERE `alias` = '$slug' LIMIT 1;" );
352+
$row = $wpdb->get_row( $wpdb->prepare( "SELECT `source`, `alias` FROM `wp_migrated_legacy_url_alias` WHERE `alias` = '%s' LIMIT 1;", $slug ) );
353353

354354
if (
355355
isset( $row->source ) && $row->source

0 commit comments

Comments
 (0)