Bug #80147 [PATCH]: BINARY strings may not be properly zero-terminated
| From: | cmb@php.net | Date: | Fri, 25 Sep 2020 09:33:37 +0000 |
| Subject: | Bug #80147 [PATCH]: BINARY strings may not be properly zero-terminated | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-229210@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80147&edit=1
ID: 80147
Patch added by: cmb@php.net
Reported by: cmb@php.net
Summary: BINARY strings may not be properly zero-terminated
Status: Assigned
Type: Bug
Package: ODBC related
Operating System: *
PHP Version: 7.3.22
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
The following pull request has been associated:
Patch Name: Fix #80147: BINARY strings may not be properly zero-terminated
On GitHub: https://github.com/php/php-src/pull/6213
Patch: https://github.com/php/php-src/pull/6213.patch
Previous Comments:
------------------------------------------------------------------------
[2020-09-25 09:15:39] cmb@php.net
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 this bug report at https://bugs.php.net/bug.php?id=80147&edit=1