From ed16b725b2948c6051be586987131e168d3d950f Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Fri, 20 Jun 2014 02:36:18 +0000 Subject: Fix a potential bug (w32 only) git-svn-id: svn://tug.org/texlive/trunk@34327 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/kpathsea/ChangeLog | 4 ++++ Build/source/texk/kpathsea/win32lib.c | 26 ++++++++++++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) (limited to 'Build/source/texk') diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index e3bf55810cc..f9df934866a 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -1,3 +1,7 @@ +2014-06-20 Akira Kakuto + + * win32lib.c: Fix a potential bug (w32 only). + 2014-06-18 Peter Breitenlohner * c-ctype.h: Avoid useless char subscript warnings. diff --git a/Build/source/texk/kpathsea/win32lib.c b/Build/source/texk/kpathsea/win32lib.c index 9de8f6fa230..32d3381a492 100644 --- a/Build/source/texk/kpathsea/win32lib.c +++ b/Build/source/texk/kpathsea/win32lib.c @@ -245,15 +245,25 @@ drive name } if(*p == '\\') { *p = '\0'; - if((hnd = FindFirstFile(q, &ffd)) == INVALID_HANDLE_VALUE) { - return 0; + if((*(p-2) == '\\' || p-1 == q) && *(p-1) == '.') { + cnt += 2; + if(cnt > len) return 0; + strcat(buff, "./"); + } else if((*(p-3) == '\\' || p-2 == q) && *(p-2) == '.' && *(p-1) == '.') { + cnt += 3; + if(cnt > len) return 0; + strcat(buff, "../"); + } else { + if((hnd = FindFirstFile(q, &ffd)) == INVALID_HANDLE_VALUE) { + return 0; + } + FindClose(hnd); + cnt += strlen(ffd.cFileName); + cnt++; + if(cnt > len) return 0; + strcat(buff, ffd.cFileName); + strcat(buff, "/"); } - FindClose(hnd); - cnt += strlen(ffd.cFileName); - cnt++; - if(cnt > len) return 0; - strcat(buff, ffd.cFileName); - strcat(buff, "/"); *p = '\\'; } } -- cgit v1.2.3