php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2501 Buffer overflow causing segfault in date()
Submitted: 1999-10-12 18:30 UTC Modified: 1999-10-13 01:50 UTC
From: dharple at mail dot communityconnect dot com Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.12 OS: Linux (any really)
Private report: No CVE-ID: None
 [1999-10-12 18:30 UTC] dharple at mail dot communityconnect dot com
In _php3_date, the for loop that determines the size of the string to create is missing a case for 'g', causing the calculated size to be off by one.  The problem only appears to show up under Linux (making me think there's something else wrong as well).

The PHP code that caused the problem was:
	$fo = date( "D, M d, Y @ g:i a", $ts ) ;

I only discovered it after rigorous debugging, as it doesn't cause a seg fault all the time.  It would only occur if the hour ('g') and the day of the month ('d') was greater than 9, and it wouldn't always occur then (I don't know why).

To work around it, I added an extra space at the end of the 'a'.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-10-13 01:50 UTC] jah at cvs dot php dot net
Already fixed in current CVS by Andrei (Aug 2 1999).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 10 05:01:31 2024 UTC