Bug #80147 [Asn->Csd]: BINARY strings may not be properly zero-terminated
| From: | cmb@php.net | Date: | Fri, 25 Sep 2020 11:54:00 +0000 |
| Subject: | Bug #80147 [Asn->Csd]: BINARY strings may not be properly zero-terminated | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-229211@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
Updated by: cmb@php.net
Reported by: cmb@php.net
Summary: BINARY strings may not be properly zero-terminated
-Status: Assigned
+Status: Closed
Type: Bug
Package: ODBC related
Operating System: *
PHP Version: 7.3.22
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a49555a9e1547a513e2f22d0a2a3ef92cddbec3d
Log: Fix #80147: BINARY strings may not be properly zero-terminated
Previous Comments:
------------------------------------------------------------------------
[2020-09-25 09:33:37] cmb@php.net
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
------------------------------------------------------------------------
[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