summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorSSE4 <tomskside@gmail.com>2018-02-12 17:10:35 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2018-02-12 17:10:35 (GMT)
commit3c34aad4e7a95913ec7db8e5e948a8fc69047bf7 (patch)
tree53894ed7dec376f07d8e9a6944e6ae97dc533156 /Modules/posixmodule.c
parent6ea20fc719dcaf102d2cefa1786f0421514f7a58 (diff)
downloadcpython-3c34aad4e7a95913ec7db8e5e948a8fc69047bf7.zip
cpython-3c34aad4e7a95913ec7db8e5e948a8fc69047bf7.tar.gz
cpython-3c34aad4e7a95913ec7db8e5e948a8fc69047bf7.tar.bz2
bpo-29248: Fix os.readlink() on Windows (GH-5577)
The PrintNameOffset field of the reparse data buffer was treated as a number of characters instead of bytes.
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 84b5b99..72fda6a 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -7439,11 +7439,11 @@ win_readlink(PyObject *self, PyObject *args, PyObject *kwargs)
"not a symbolic link");
return NULL;
}
- print_name = rdb->SymbolicLinkReparseBuffer.PathBuffer +
- rdb->SymbolicLinkReparseBuffer.PrintNameOffset;
+ print_name = (wchar_t *)((char*)rdb->SymbolicLinkReparseBuffer.PathBuffer +
+ rdb->SymbolicLinkReparseBuffer.PrintNameOffset);
result = PyUnicode_FromWideChar(print_name,
- rdb->SymbolicLinkReparseBuffer.PrintNameLength/2);
+ rdb->SymbolicLinkReparseBuffer.PrintNameLength / sizeof(wchar_t));
return result;
}