Fix _Py_normalize_encoding(): ensure that buffer is big enough to store "utf-8"

if the input string is NULL
This commit is contained in:
Victor Stinner 2013-11-07 13:33:36 +01:00
parent e75fc14813
commit df23e30bea
1 changed files with 2 additions and 0 deletions

View File

@ -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;
}