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