Download & Extend

Useless db_escape_string in node_load()

Project:Drupal core
Version:7.x-dev
Component:node system
Category:task
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

node.module:521 - node_load()

<?php
foreach ($param as $key => $value) {
  
$cond[] = 'n.'. db_escape_string($key) ." = '%s'";
  
$arguments[] = $value;
}
?>

As $key is not used in a string context (surrouned by ''),
db_escape_string is useless. (initial report by Heine).

Comments

#1

Status:active» needs review

And the patch.

AttachmentSizeStatusTest resultOperations
node-escape-table.patch690 bytesIgnored: Check issue status.NoneNone

#2

Status:needs review» reviewed & tested by the community

As per originating issue, changing to RTBC.

#3

Version:6.0» 5.x-dev

Applicable to 5.x and 7.x as well. Moving back to 5.x but also need to be committed to 7.x then.

#4

(I committed to 6.x.).

#5

For the record, the initial report was by Stefan Esser, Mayflower & Zend in an audit commissioned by Die Zeit.

#6

patch for D7, from http://drupal.org/node/228233

AttachmentSizeStatusTest resultOperations
node_load-db_escape_table-0.1.patch780 bytesIgnored: Check issue status.NoneNone

#7

Version:5.x-dev» 7.x-dev

Committed to 5.x.

#8

Status:reviewed & tested by the community» needs work

This no longer applies, but it's going to be obsolete after #225450: Database Layer: The Next Generation gets in anyway.

#9

Status:needs work» reviewed & tested by the community

Since it was RTBC before, this is a re-roll, and this is not a huge patch, marking RTBC again

AttachmentSizeStatusTest resultOperations
node_load-db_escape_table.patch1000 bytesIgnored: Check issue status.NoneNone

#10

Status:reviewed & tested by the community» fixed

Committed to CVS HEAD. Thanks!

#11

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

nobody click here