From df23e30bea2741087440c186e645e6ae4c218651 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 7 Nov 2013 13:33:36 +0100 Subject: [PATCH] Fix _Py_normalize_encoding(): ensure that buffer is big enough to store "utf-8" if the input string is NULL --- Objects/unicodeobject.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 4ae73771f23..1375ef3093d 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -2983,6 +2983,8 @@ _Py_normalize_encoding(const char *encoding, char *l_end; if (encoding == NULL) { + if (lower_len < 6) + return 0; strcpy(lower, "utf-8"); return 1; }