]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix _Py_normalize_encoding(): ensure that buffer is big enough to store "utf-8"
authorVictor Stinner <victor.stinner@gmail.com>
Thu, 7 Nov 2013 12:33:36 +0000 (13:33 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Thu, 7 Nov 2013 12:33:36 +0000 (13:33 +0100)
if the input string is NULL

Objects/unicodeobject.c

index 4ae73771f238fddba6d58ad1427048cb2537c346..1375ef3093d7cbc6d19cdc34c22f8c65b4fdfad5 100644 (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;
     }