php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80147 BINARY strings may not be properly zero-terminated
Submitted: 2020-09-25 09:15 UTC Modified: 2020-09-25 09:15 UTC
From: cmb@php.net Assigned: cmb (profile)
Status: Closed Package: ODBC related
PHP Version: 7.3.22 OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: cmb@php.net
New email:
PHP Version: OS:

 

 [2020-09-25 09:15 UTC] 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


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-09-25 09:15 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2020-09-25 09:33 UTC] 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 11:54 UTC] cmb@php.net
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
 [2020-09-25 11:54 UTC] cmb@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 05 16:01:30 2024 UTC