Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit df23e30

Browse files
committed
Fix _Py_normalize_encoding(): ensure that buffer is big enough to store "utf-8"
if the input string is NULL
1 parent e75fc14 commit df23e30

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

Objects/unicodeobject.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2983,6 +2983,8 @@ _Py_normalize_encoding(const char *encoding,
29832983
char *l_end;
29842984

29852985
if (encoding == NULL) {
2986+
if (lower_len < 6)
2987+
return 0;
29862988
strcpy(lower, "utf-8");
29872989
return 1;
29882990
}

0 commit comments

Comments
 (0)