|  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
 [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.


Add a Patch

Pull Requests

Add a Pull Request


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: Sun Nov 27 16:05:53 2022 UTC