From 0fba9b324f061a4c8af9f39c3d0befdf29e2a216 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Sat, 5 Sep 2015 20:55:34 -0700 Subject: Issue #24917: time_strftime() Buffer Over-read. Patch by John Leitch. --- Misc/NEWS | 2 ++ Modules/timemodule.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/Misc/NEWS b/Misc/NEWS index dd175fe..834e20a 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -84,6 +84,8 @@ Library - Issue #16180: Exit pdb if file has syntax error, instead of trapping user in an infinite loop. Patch by Xavier de Gaye. +- Issue #24917: time_strftime() Buffer Over-read. Patch by John Leitch. + - Issue #21112: Fix regression in unittest.expectedFailure on subclasses. Patch from Berker Peksag. diff --git a/Modules/timemodule.c b/Modules/timemodule.c index d0917a4..f729594 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -662,6 +662,12 @@ time_strftime(PyObject *self, PyObject *args) "format %y requires year >= 1900 on AIX"); return NULL; } + else if (outbuf[1] == '\0') + { + PyErr_SetString(PyExc_ValueError, "Incomplete format string"); + Py_DECREF(format); + return NULL; + } } #endif -- cgit v0.12