From:             thecwin at gmail dot com
Operating system: XP Home and Slackware Linux
PHP version:      5CVS-2004-07-26 (dev)
PHP Bug Type:     SQLite related
Bug description:  sqlite_escape_string may return a random string

Description:
------------
http://cwin.dotgeek.org/mem.php
http://cwin.redirectme.net/mem.php

If an empty string like "" is passed to a function as an argument which
then passes the argument to sqlite_escape_string($arg), the returned value
will be random garbage. The returned value may contain words or useless
data. It looks like its reading random memory.

Similar to bug 29339, but does *not* work when passing an empty string
created in the function from which it is calling sqlite_escape_string

Reproduce code:
---------------
http://cwin.redirectme.net/mem.phps

This is affected: 
<?php 
function escapeSimple($str) { 
   return @sqlite_escape_string($str); 
} 
echo escapeSimple(""); 

?> 

whereas this is not:
<?php
echo sqlite_escape_string("");
?>

Expected result:
----------------
It should return/print nothing.

Actual result:
--------------
(Possibly) random characters.

-- 
Edit bug report at http://bugs.php.net/?id=29395&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=29395&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=29395&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=29395&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=29395&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=29395&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=29395&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=29395&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=29395&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=29395&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=29395&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=29395&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=29395&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29395&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=29395&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=29395&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=29395&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29395&r=float

Reply via email to