./ and ../ are still relative paths. Only files beginning with / and X:\ should be included directly.

This commit is contained in:
Rafal Kupiec 2018-07-24 10:29:16 +02:00
parent d3be8d2a1a
commit f42f51f037
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
1 changed files with 3 additions and 4 deletions

View File

@ -2875,12 +2875,11 @@ PH7_PRIVATE void *PH7_StreamOpenHandle(ph7_vm *pVm, const ph7_io_stream *pStream
}
SyStringInitFromBuf(&sFile, zFile, SyStrlen(zFile));
if(use_include) {
if(sFile.zString[0] == '/' ||
if(sFile.zString[0] == '/'
#ifdef __WINNT__
(sFile.nByte > 2 && sFile.zString[1] == ':' && (sFile.zString[2] == '\\' || sFile.zString[2] == '/')) ||
|| (sFile.nByte > 2 && sFile.zString[1] == ':' && (sFile.zString[2] == '\\' || sFile.zString[2] == '/')) ||
#endif
(sFile.nByte > 1 && sFile.zString[0] == '.' && sFile.zString[1] == '/') ||
(sFile.nByte > 2 && sFile.zString[0] == '.' && sFile.zString[1] == '.' && sFile.zString[2] == '/')) {
) {
/* Get real path to the included file */
SyRealPath(zFile, sFilePath);
/* Open the file directly */