Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit aa2fcc6

Browse files
committed
Issue python#24917: time_strftime() buffer over-read.
1 parent e8d58d1 commit aa2fcc6

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ Core and Builtins
8181
Library
8282
-------
8383

84+
- Issue #24917: time_strftime() buffer over-read.
85+
8486
- Issue #23144: Make sure that HTMLParser.feed() returns all the data, even
8587
when convert_charrefs is True.
8688

Modules/timemodule.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,8 @@ time_strftime(PyObject *self, PyObject *args)
655655
outbuf != NULL;
656656
outbuf = wcschr(outbuf+2, '%'))
657657
{
658+
if (outbuf[1] == L'\0')
659+
break;
658660
/* Issue #19634: On AIX, wcsftime("y", (1899, 1, 1, 0, 0, 0, 0, 0, 0))
659661
returns "0/" instead of "99" */
660662
if (outbuf[1] == L'y' && buf.tm_year < 0) {

0 commit comments

Comments
 (0)