|  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: Assigned: cmb (profile)
Status: Closed Package: ODBC related
PHP Version: 7.3.22 OS: *
Private report: No CVE-ID: None
 [2020-09-25 09:15 UTC]
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:
$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);
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


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-09-25 09:15 UTC]
-Assigned To: +Assigned To: cmb
 [2020-09-25 09:33 UTC]
The following pull request has been associated:

Patch Name: Fix #80147: BINARY strings may not be properly zero-terminated
On GitHub:
 [2020-09-25 11:54 UTC]
Automatic comment on behalf of
Log: Fix #80147: BINARY strings may not be properly zero-terminated
 [2020-09-25 11:54 UTC]
-Status: Assigned +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 16 16:01:27 2024 UTC