[hackers] [quark] Adjust last-byte-pos greater than files || Quentin Rameau

From: <git_AT_suckless.org>
Date: Sat, 22 Jul 2017 13:32:11 +0200 (CEST)

commit 432898af71af69203f2fa33aa604f0461206e49a
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Sat Jul 22 00:07:23 2017 +0200
Commit: Laslo Hunhold <dev_AT_frign.de>
CommitDate: Sat Jul 22 13:32:06 2017 +0200

    Adjust last-byte-pos greater than files

diff --git a/quark.c b/quark.c
index 07cec1e..c7681e5 100644
--- a/quark.c
+++ b/quark.c
_AT_@ -721,8 +721,7 @@ sendresponse(int fd, struct request *r)
                 }
 
                 /* check range */
- if (lower < 0 || upper < 0 || lower > upper ||
- upper >= st.st_size) {
+ if (lower < 0 || upper < 0 || lower > upper) {
                         if (dprintf(fd,
                                     "HTTP/1.1 %d %s\r\n"
                                     "Date: %s\r\n"
_AT_@ -737,6 +736,10 @@ sendresponse(int fd, struct request *r)
                         }
                         return S_RANGE_NOT_SATISFIABLE;
                 }
+
+ /* adjust upper limit */
+ if (upper >= st.st_size)
+ upper = st.st_size-1;
         }
 
         /* mime */
Received on Sat Jul 22 2017 - 13:32:11 CEST

This archive was generated by hypermail 2.3.0 : Sat Jul 22 2017 - 13:38:17 CEST