summaryrefslogtreecommitdiff
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-11-07 13:33:36 +0100
committerVictor Stinner <victor.stinner@gmail.com>2013-11-07 13:33:36 +0100
commitdf23e30bea2741087440c186e645e6ae4c218651 (patch)
tree85565f759a339e1d2199cf45d0ce387a8b5478e8 /Objects/unicodeobject.c
parente75fc148136bbef192c5572c14f3abf1f67abc57 (diff)
downloadcpython-git-df23e30bea2741087440c186e645e6ae4c218651.tar.gz
Fix _Py_normalize_encoding(): ensure that buffer is big enough to store "utf-8"
if the input string is NULL
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 4ae73771f2..1375ef3093 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;
}