aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/drivers/win32/win_efile.c
diff options
context:
space:
mode:
authorPatrik Nyblom <[email protected]>2012-08-30 16:56:43 +0200
committerPatrik Nyblom <[email protected]>2012-08-30 16:56:43 +0200
commit07905276ce951d59b400516f9a4601d376b383b9 (patch)
tree6d71721b74104d00ca61646a52a418e1753c6e4e /erts/emulator/drivers/win32/win_efile.c
parentda477e3fc1bcac8d8afb4d3eef6d250d4eae37e0 (diff)
parentcf6d1faf367b47c79ded23afc0d3fd3f38abfaea (diff)
downloadotp-07905276ce951d59b400516f9a4601d376b383b9.tar.gz
otp-07905276ce951d59b400516f9a4601d376b383b9.tar.bz2
otp-07905276ce951d59b400516f9a4601d376b383b9.zip
Merge branch 'pan/win_readlink/OTP-10200' into maint
* pan/win_readlink/OTP-10200: Teach VM not to dump core on long pathnames
Diffstat (limited to 'erts/emulator/drivers/win32/win_efile.c')
-rw-r--r--erts/emulator/drivers/win32/win_efile.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/erts/emulator/drivers/win32/win_efile.c b/erts/emulator/drivers/win32/win_efile.c
index 606fa1d7de..a3a5944245 100644
--- a/erts/emulator/drivers/win32/win_efile.c
+++ b/erts/emulator/drivers/win32/win_efile.c
@@ -897,7 +897,8 @@ efile_fileinfo(Efile_error* errInfo, Efile_info* pInfo,
we should be able to find its target */
WCHAR target_name[_MAX_PATH];
if (efile_readlink(errInfo, (char *) name,
- (char *) target_name,256) == 1) {
+ (char *) target_name,
+ _MAX_PATH * sizeof(WCHAR)) == 1) {
FindClose(findhandle);
return efile_fileinfo(errInfo, pInfo,
(char *) target_name, info_for_link);
@@ -1386,7 +1387,7 @@ efile_readlink(Efile_error* errInfo, char* name, char* buffer, size_t size)
HANDLE h = CreateFileW(wname, GENERIC_READ, 0,NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
int len;
if(h != INVALID_HANDLE_VALUE) {
- success = pGetFinalPathNameByHandle(h, wbuffer, size,0);
+ success = pGetFinalPathNameByHandle(h, wbuffer, size / sizeof(WCHAR),0);
/* GetFinalPathNameByHandle prepends path with "\\?\": */
len = wcslen(wbuffer);
wmemmove(wbuffer,wbuffer+4,len-3);