[exim-cvs] kevent: fix directory check

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Exim Git Commits Mailing List
Datum:  
To: exim-cvs
Betreff: [exim-cvs] kevent: fix directory check
Gitweb: https://git.exim.org/exim.git/commitdiff/8c6732214b2c585148ead48b668a2cd819bde158
Commit:     8c6732214b2c585148ead48b668a2cd819bde158
Parent:     ffbb6f2982821e44c42da6b8816e4560f5a9accb
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Sat Oct 10 15:04:53 2020 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Sat Oct 10 15:04:53 2020 +0100


    kevent: fix directory check
---
 src/src/tls.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)


diff --git a/src/src/tls.c b/src/src/tls.c
index d213fef..5adab7c 100644
--- a/src/src/tls.c
+++ b/src/src/tls.c
@@ -165,15 +165,16 @@ if (Ustrcmp(filename, "system,cache") == 0) return TRUE;

 for (;;)
   {
-  if (!(s = Ustrrchr(filename, '/'))) return FALSE;
-  if ((lstat(CCS filename, &sb)) < 0) { s = US"lstat"; goto bad; }
   if (kev_used > KEV_SIZE-2) { s = US"out of kev space"; goto bad; }
+  if (!(s = Ustrrchr(filename, '/'))) return FALSE;
+  s = string_copyn(filename, s - filename);    /* mem released by tls_set_watch */


/* The dir open will fail if there is a symlink on the path. Fine; it's too
much effort to handle all possible cases; just refuse the preload. */

if ((fd2 = open(CCS s, O_RDONLY | O_NOFOLLOW)) < 0) { s = US"open dir"; goto bad; }

+  if ((lstat(CCS filename, &sb)) < 0) { s = US"lstat"; goto bad; }
   if (!S_ISLNK(sb.st_mode))
     {
     if ((fd1 = open(CCS filename, O_RDONLY | O_NOFOLLOW)) < 0)