# HG changeset patch # User Steve Dower # Date 1486253330 28800 # Sat Feb 04 16:08:50 2017 -0800 # Branch 3.5 # Node ID f59cc6b2457898f9cb747be5c114a2726735d8a9 # Parent c6506f759db1c7a1a412959f008fc4568be2a768 Issue #23462: Prevent crash calling execve with str path diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -52,6 +52,8 @@ Windows ------- +- Issue #23462: Prevent crash calling execve with str path + - Issue #29392: Prevent crash when passing invalid arguments into msvcrt module. C API diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -5126,7 +5126,19 @@ fexecve(path->fd, argvlist, envlist); else #endif + if (path->narrow) execve(path->narrow, argvlist, envlist); +#ifdef MS_WINDOWS + else if (path->wide) { + PyErr_SetString(PyExc_TypeError, + "execve: only bytes are supported for path"); + goto fail; + } +#endif + else { + PyErr_SetString(PyExc_TypeError, "execve: path is not valid"); + goto fail; + } /* If we get here it's definitely an error */