To: vim_dev@googlegroups.com Subject: Patch 8.0.1030 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1030 Problem: MS-Windows: wrong size computation in is_cygpty(). Solution: Compute the size properly. (Ken Takata) Files: src/iscygpty.c, src/iscygpty.h *** ../vim-8.0.1029/src/iscygpty.c 2016-08-29 22:42:20.000000000 +0200 --- src/iscygpty.c 2017-08-31 21:30:35.405028967 +0200 *************** *** 2,8 **** * iscygpty.c -- part of ptycheck * https://github.com/k-takata/ptycheck * ! * Copyright (c) 2015-2016 K.Takata * * You can redistribute it and/or modify it under the terms of either * the MIT license (as described below) or the Vim license. --- 2,8 ---- * iscygpty.c -- part of ptycheck * https://github.com/k-takata/ptycheck * ! * Copyright (c) 2015-2017 K.Takata * * You can redistribute it and/or modify it under the terms of either * the MIT license (as described below) or the Vim license. *************** *** 27,32 **** --- 27,34 ---- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + #ifdef _WIN32 + #include #include #include *************** *** 60,78 **** //#define USE_DYNFILEID #ifdef USE_DYNFILEID typedef BOOL (WINAPI *pfnGetFileInformationByHandleEx)( ! HANDLE hFile, FILE_INFO_BY_HANDLE_CLASS FileInformationClass, ! LPVOID lpFileInformation, ! DWORD dwBufferSize ); static pfnGetFileInformationByHandleEx pGetFileInformationByHandleEx = NULL; # ifndef USE_FILEEXTD static BOOL WINAPI stub_GetFileInformationByHandleEx( ! HANDLE hFile, FILE_INFO_BY_HANDLE_CLASS FileInformationClass, ! LPVOID lpFileInformation, ! DWORD dwBufferSize ) { return FALSE; --- 62,80 ---- //#define USE_DYNFILEID #ifdef USE_DYNFILEID typedef BOOL (WINAPI *pfnGetFileInformationByHandleEx)( ! HANDLE hFile, FILE_INFO_BY_HANDLE_CLASS FileInformationClass, ! LPVOID lpFileInformation, ! DWORD dwBufferSize ); static pfnGetFileInformationByHandleEx pGetFileInformationByHandleEx = NULL; # ifndef USE_FILEEXTD static BOOL WINAPI stub_GetFileInformationByHandleEx( ! HANDLE hFile, FILE_INFO_BY_HANDLE_CLASS FileInformationClass, ! LPVOID lpFileInformation, ! DWORD dwBufferSize ) { return FALSE; *************** *** 111,117 **** return 0; #else HANDLE h; ! int size = sizeof(FILE_NAME_INFO) + sizeof(WCHAR) * MAX_PATH; FILE_NAME_INFO *nameinfo; WCHAR *p = NULL; --- 113,119 ---- return 0; #else HANDLE h; ! int size = sizeof(FILE_NAME_INFO) + sizeof(WCHAR) * (MAX_PATH - 1); FILE_NAME_INFO *nameinfo; WCHAR *p = NULL; *************** *** 125,131 **** if (GetFileType(h) != FILE_TYPE_PIPE) { return 0; } ! nameinfo = malloc(size); if (nameinfo == NULL) { return 0; } --- 127,133 ---- if (GetFileType(h) != FILE_TYPE_PIPE) { return 0; } ! nameinfo = malloc(size + sizeof(WCHAR)); if (nameinfo == NULL) { return 0; } *************** *** 178,181 **** return ret; } ! /* vi:set ts=8 sts=4 sw=4 noet: */ --- 180,185 ---- return ret; } ! #endif /* _WIN32 */ ! ! /* vim: set ts=4 sw=4: */ *** ../vim-8.0.1029/src/iscygpty.h 2016-06-26 20:29:37.000000000 +0200 --- src/iscygpty.h 2017-08-31 21:30:35.405028967 +0200 *************** *** 2,8 **** * iscygpty.h -- part of ptycheck * https://github.com/k-takata/ptycheck * ! * Copyright (c) 2015-2016 K.Takata * * You can redistribute it and/or modify it under the terms of either * the MIT license (as described below) or the Vim license. --- 2,8 ---- * iscygpty.h -- part of ptycheck * https://github.com/k-takata/ptycheck * ! * Copyright (c) 2015-2017 K.Takata * * You can redistribute it and/or modify it under the terms of either * the MIT license (as described below) or the Vim license. *************** *** 30,36 **** --- 30,41 ---- #ifndef _ISCYGPTY_H #define _ISCYGPTY_H + #ifdef _WIN32 int is_cygpty(int fd); int is_cygpty_used(void); + #else + #define is_cygpty(fd) 0 + #define is_cygpty_used() 0 + #endif #endif /* _ISCYGPTY_H */ *** ../vim-8.0.1029/src/version.c 2017-08-31 20:57:57.786313453 +0200 --- src/version.c 2017-08-31 21:30:31.189057668 +0200 *************** *** 771,772 **** --- 771,774 ---- { /* Add new patch number below this line */ + /**/ + 1030, /**/ -- Latest survey shows that 3 out of 4 people make up 75% of the world's population. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///