Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0fba9b3

Browse files
committed
Issue #24917: time_strftime() Buffer Over-read. Patch by John Leitch.
1 parent ca3f435 commit 0fba9b3

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ Library
8484
- Issue #16180: Exit pdb if file has syntax error, instead of trapping user
8585
in an infinite loop. Patch by Xavier de Gaye.
8686

87+
- Issue #24917: time_strftime() Buffer Over-read. Patch by John Leitch.
88+
8789
- Issue #21112: Fix regression in unittest.expectedFailure on subclasses.
8890
Patch from Berker Peksag.
8991

Modules/timemodule.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,12 @@ time_strftime(PyObject *self, PyObject *args)
662662
"format %y requires year >= 1900 on AIX");
663663
return NULL;
664664
}
665+
else if (outbuf[1] == '\0')
666+
{
667+
PyErr_SetString(PyExc_ValueError, "Incomplete format string");
668+
Py_DECREF(format);
669+
return NULL;
670+
}
665671
}
666672
#endif
667673

0 commit comments

Comments
 (0)