php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37920 Hardcoded ASCII values in cgi_main.c
Submitted: 2006-06-26 21:23 UTC Modified: 2006-06-27 08:28 UTC
From: agiorgio at optonline dot net Assigned:
Status: Closed Package: *Compile Issues
PHP Version: 5.1.5CVS OS: z/OS
Private report: No CVE-ID: None
 [2006-06-26 21:23 UTC] agiorgio at optonline dot net
Description:
------------
There are hardcoded ASCII values in cgi_main.c.  0x10 should be '\n' and 0x13 should be '\r'.

Reproduce code:
---------------
while (c != 10 && c != 13) {
	c = fgetc(file_handle.handle.fp);	/* skip to end of line */
}
/* handle situations where line is terminated by \r\n */
if (c == 13) {
	if (fgetc(file_handle.handle.fp) != 10) {
		long pos = ftell(file_handle.handle.fp);
		fseek(file_handle.handle.fp, pos - 1, SEEK_SET);
	}
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-26 21:36 UTC] tony2001@php.net
You forgot to explain what the problem is.
 [2006-06-26 23:22 UTC] agiorgio at optonline dot net
This code does not compile correctly on non-ASCII systems, like IBM z/OS.
 [2006-06-27 08:28 UTC] tony2001@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Fix committed to 5_2 and HEAD.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 00:01:27 2024 UTC