php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #210 re #185 fputs puts wrong count.
Submitted: 1998-03-28 19:10 UTC Modified: 1998-03-29 13:05 UTC
From: philip at qs dot co dot nz Assigned:
Status: Closed Package: Other
PHP Version: 3.0b6 OS: Linux-ELF i586
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: philip at qs dot co dot nz
New email:
PHP Version: OS:

 

 [1998-03-28 19:10 UTC] philip at qs dot co dot nz
Please re-read Bug #185.

If it is the correct behaviour to write crap to the end of
file when there are backslashes in the string then you need
your head examined.

For those people who care:

The error is in functions/file.c:702
                ret = fwrite(buf,arg2->strlen,1,fp);
Change this to:
                ret = fwrite(buf,strlen(buf),1,fp);

When magic quotes are on, the input string as copied to a temporaty bufer
called buf and has the backslashes stripped. This may result
in the line becoming shorter than the input line.
Because arg2->strlen is not updated too many characters are written
to the file.
This fix may break the use of binary data in srings.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-03-29 13:05 UTC] jim
This has been fixed correctly in the latest CVS.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Dec 08 05:05:52 2022 UTC