Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
allocate 6 more bytes for the formatted date buffer only when %F is s…
…upported
  • Loading branch information
blhsing committed Jul 31, 2024
commit fd8dd3099de4a4817bfabd8a88205e7e17aef172
11 changes: 7 additions & 4 deletions Modules/_datetimemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1852,10 +1852,13 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
Py_ssize_t ntoappend; /* # of bytes to append to output buffer */

#ifdef Py_NORMALIZE_CENTURY
/* Buffer of maximum size of formatted year permitted by long.
* Adding 6 just to accomodate %F with dashes, 2-digit month and day.
*/
char buf[SIZEOF_LONG*5/2+2+6];
/* Buffer of maximum size of formatted year permitted by long. */
char buf[SIZEOF_LONG * 5 / 2 + 2
#ifdef Py_STRFTIME_C99_SUPPORT
/* Need 6 more to accomodate dashes, 2-digit month and day for %F. */
+ 6
#endif
];
#endif

assert(object && format && timetuple);
Expand Down