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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
37 - 29 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 05:01:29 2024 UTC