Bug #80147 [NEW]: BINARY strings may not be properly zero-terminated
| From: | cmb@php.net | Date: | Fri, 25 Sep 2020 09:15:39 +0000 |
| Subject: | Bug #80147 [NEW]: BINARY strings may not be properly zero-terminated | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-229208@lists.php.net to get a copy of this message | ||
From: cmb
Operating system: *
PHP version: 7.3.22
Package: ODBC related
Bug Type: Bug
Bug description:BINARY strings may not be properly zero-terminated
Description:
------------
When fetching BINARY, VARBINARY or LONGVARBINARY data from the
data source with the (default) binary mode ODBC_BINMODE_RETURN,
the returned strings may not be properly zero-terminated, what may
cause issues later.
Test script:
---------------
<?php
$conn = odbc_connect($dsn, $user, $pass);
odbc_exec($conn, "CREATE TABLE test (id INT, whatever VARBINARY(50))");
odbc_exec($conn, "INSERT INTO test VALUES (1, CONVERT(VARBINARY(50),
'whatever'))");
$res = odbc_exec($conn, "SELECT * FROM test");
odbc_binmode($res, ODBC_BINMODE_RETURN);
odbc_fetch_row($res);
var_dump(odbc_result($res, 'whatever'));
?>
Expected result:
----------------
string(8) "whatever"
Actual result:
--------------
string(8) "whatever"
Warning: String is not zero-terminated (whatever) in %s on line %d
--
Edit bug report at https://bugs.php.net/bug.php?id=80147&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80147&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80147&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80147&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80147&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80147&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80147&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80147&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80147&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80147&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80147&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80147&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80147&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80147&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80147&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80147&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80147&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80147&r=mysqlcfg