[hackers] [quark] Fix logic error in vhost chrooting (from e592bbc) || Quentin Rameau

From: <git_AT_suckless.org>
Date: Thu, 13 Jul 2017 21:11:08 +0200 (CEST)

commit 21115d4a1befb0b9fd139aaa47a2f22efb0f6ba4
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Thu Jul 13 19:05:21 2017 +0200
Commit: Laslo Hunhold <dev_AT_frign.de>
CommitDate: Thu Jul 13 21:11:06 2017 +0200

    Fix logic error in vhost chrooting (from e592bbc)
    
    Thanks Hiltjo for having spotted it!

diff --git a/quark.c b/quark.c
index 755b94d..14044ae 100644
--- a/quark.c
+++ b/quark.c
_AT_@ -568,9 +568,12 @@ sendresponse(int fd, struct request *r)
                 for (i = 0; i < LEN(vhost); i++) {
                         /* switch to vhost directory if there is a match */
                         if (!regexec(&vhost[i].re, r->field[REQ_HOST], 0,
- NULL, 0) && chdir(vhost[i].dir) < 0) {
- return sendstatus(fd, (errno == EACCES) ?
- S_FORBIDDEN : S_NOT_FOUND);
+ NULL, 0) {
+ if (chdir(vhost[i].dir) < 0) {
+ return sendstatus(fd, (errno == EACCES)
+ ? S_FORBIDDEN : S_NOT_FOUND);
+ }
+ break;
                         }
                 }
         }
Received on Thu Jul 13 2017 - 21:11:08 CEST

This archive was generated by hypermail 2.3.0 : Thu Jul 13 2017 - 21:12:53 CEST