summaryrefslogtreecommitdiff
path: root/Modules/overlapped.c
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2017-02-04 15:05:40 -0800
committerSteve Dower <steve.dower@microsoft.com>2017-02-04 15:05:40 -0800
commitb2fa705fd3887c326e811c418469c784353027f4 (patch)
treeb3428f73de91453edbfd4df1a5d4a212d182eb44 /Modules/overlapped.c
parent134e58fd3aaa2e91390041e143f3f0a21a60142b (diff)
parentb53654b6dbfce8318a7d4d1cdaddca7a7fec194b (diff)
downloadcpython-b2fa705fd3887c326e811c418469c784353027f4.tar.gz
Issue #29392: Prevent crash when passing invalid arguments into msvcrt module.
Diffstat (limited to 'Modules/overlapped.c')
-rw-r--r--Modules/overlapped.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/Modules/overlapped.c b/Modules/overlapped.c
index f85e5bc736..0aa8657898 100644
--- a/Modules/overlapped.c
+++ b/Modules/overlapped.c
@@ -973,28 +973,28 @@ Overlapped_AcceptEx(OverlappedObject *self, PyObject *args)
static int
parse_address(PyObject *obj, SOCKADDR *Address, int Length)
{
- char *Host;
+ Py_UNICODE *Host;
unsigned short Port;
unsigned long FlowInfo;
unsigned long ScopeId;
memset(Address, 0, Length);
- if (PyArg_ParseTuple(obj, "sH", &Host, &Port))
+ if (PyArg_ParseTuple(obj, "uH", &Host, &Port))
{
Address->sa_family = AF_INET;
- if (WSAStringToAddressA(Host, AF_INET, NULL, Address, &Length) < 0) {
+ if (WSAStringToAddressW(Host, AF_INET, NULL, Address, &Length) < 0) {
SetFromWindowsErr(WSAGetLastError());
return -1;
}
((SOCKADDR_IN*)Address)->sin_port = htons(Port);
return Length;
}
- else if (PyArg_ParseTuple(obj, "sHkk", &Host, &Port, &FlowInfo, &ScopeId))
+ else if (PyArg_ParseTuple(obj, "uHkk", &Host, &Port, &FlowInfo, &ScopeId))
{
PyErr_Clear();
Address->sa_family = AF_INET6;
- if (WSAStringToAddressA(Host, AF_INET6, NULL, Address, &Length) < 0) {
+ if (WSAStringToAddressW(Host, AF_INET6, NULL, Address, &Length) < 0) {
SetFromWindowsErr(WSAGetLastError());
return -1;
}