Skip to content

ext/date: Fix truncated timezone name for UTC offsets of 100 hours or more - #25457

Open
jorgsowa wants to merge 1 commit into
php:PHP-8.4from
jorgsowa:fix-date-tz-offset-str
Open

jorgsowa wants to merge 1 commit into
php:PHP-8.4from
jorgsowa:fix-date-tz-offset-str

Conversation

@jorgsowa

Copy link
Copy Markdown
Contributor

DateTime::createFromFormat() accepts offsets like +9999, whose name does not fit the fixed-size buffer: snprintf() truncated it, and the returned length overran the allocation, so the string was missing its terminating NUL. GH-9763 only rejected such offsets in the DateTimeZone constructor.

It's not really the correct offset, but it should be fixed in timelib. This is fix only for PHP side.

DateTime::createFromFormat() accepts offsets like +9999, whose name
does not fit the fixed-size buffer: snprintf() truncated it, and the
returned length overran the allocation, so the string was missing its
terminating NUL. phpGH-9763 only rejected such offsets in the
DateTimeZone constructor.
@jorgsowa jorgsowa self-assigned this Nov 14, 2026
@jorgsowa
jorgsowa requested a review from derickr as a code owner November 14, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants