From:             
Operating system: All
PHP version:      5.3.6
Package:          PDO related
Bug Type:         Bug
Bug description:mysqlnd valid_sjis_(head|tail) is using invalid operator and 
range.

Description:
------------
impacts to:

1. mysqli->real_escape_string

2. use PDO at PDO::ATTR_EMULATE_PREPARES = true



"real_escape_string" must not escape multi-byte character.

but escape it.



This bug is a SQL-injection may cause.

Test script:
---------------
<?php

$japanese_so = pack('H4', '835c');



$mysql = mysqli_connect('localhost', 'sandbox', 'sandbox');

$mysql->set_charset('sjis');

echo $mysql->real_escape_string($japanese_so) === $japanese_so ? 'ok' :
'ng';

echo "\n";



Expected result:
----------------
echo "ok\n"

Actual result:
--------------
echo "ng\n"

-- 
Edit bug report at http://bugs.php.net/bug.php?id=54674&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=54674&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=54674&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=54674&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=54674&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=54674&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=54674&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=54674&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=54674&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=54674&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=54674&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=54674&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=54674&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=54674&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=54674&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=54674&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=54674&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=54674&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=54674&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=54674&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=54674&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=54674&r=mysqlcfg

Reply via email to