diff options
author | Steve Dower <steve.dower@microsoft.com> | 2017-02-04 15:05:50 -0800 |
---|---|---|
committer | Steve Dower <steve.dower@microsoft.com> | 2017-02-04 15:05:50 -0800 |
commit | 3b0e4320092ac0504b6670cafaf0301b908c91fc (patch) | |
tree | d3be1b6b844d61763bb366fa21ceed475e5703fd /Python/pylifecycle.c | |
parent | b2fa705fd3887c326e811c418469c784353027f4 (diff) | |
parent | f687fbcd73c14dfcbe086eb5cd94b298f1e81e72 (diff) | |
download | cpython-3b0e4320092ac0504b6670cafaf0301b908c91fc.tar.gz |
Issue #29392: Prevent crash when passing invalid arguments into msvcrt module.
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r-- | Python/pylifecycle.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index a4f7f823bc..06030c330a 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -193,7 +193,8 @@ add_flag(int flag, const char *envs) static char* get_codec_name(const char *encoding) { - char *name_utf8, *name_str; + const char *name_utf8; + char *name_str; PyObject *codec, *name = NULL; codec = _PyCodec_Lookup(encoding); @@ -1284,8 +1285,7 @@ initstdio(void) when import.c tries to write to stderr in verbose mode. */ encoding_attr = PyObject_GetAttrString(std, "encoding"); if (encoding_attr != NULL) { - const char * std_encoding; - std_encoding = PyUnicode_AsUTF8(encoding_attr); + const char *std_encoding = PyUnicode_AsUTF8(encoding_attr); if (std_encoding != NULL) { PyObject *codec_info = _PyCodec_Lookup(std_encoding); Py_XDECREF(codec_info); |