|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #566 pg_lowrite will not handle nulls in the data
Submitted: 1998-07-22 06:02 UTC Modified: 1998-07-22 10:15 UTC
From: scott at elysium dot demon dot co dot uk Assigned:
Status: Closed Package: PostgreSQL related
PHP Version: 3.0.2 OS: Linux 2.0
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: scott at elysium dot demon dot co dot uk
New email:
PHP Version: OS:


 [1998-07-22 06:02 UTC] scott at elysium dot demon dot co dot uk
It seems that the pg_lowrite function was using strlen() to calculate the amount of data to write. This meant that it would not write data correctly if there was a null byte in it. This can be fixed by the following patch which changes it to use the str->value.str.len variable for the amount of data to write.

*** pgsql.c.orig        Mon Jun 29 13:36:54 1998
--- pgsql.c     Wed Jul 22 10:28:10 1998
*** 1311,1316 ****
--- 1311,1317 ----
                        id = pgsql_id->value.lval;
                        buf = str->value.str.val;
+                       buf_len = str->value.str.len;
*** 1323,1329 ****
-       buf_len = strlen(buf);
        if ((nbytes = lo_write((PGconn *)pgsql->conn, pgsql->lofd, buf, buf_len))==-1) {
--- 1324,1329 ----


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [1998-07-22 10:15 UTC] rasmus
Applied - thanks for catching that
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Jan 26 08:03:33 2022 UTC