[hackers] [quark] byte-range: fix range check for upper limit || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Tue, 4 Jul 2017 21:03:52 +0200 (CEST)

commit 9b8e2bdeb6abe8b42818ad2c9e4e118b09474261
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
AuthorDate: Tue Jul 4 18:18:24 2017 +0200
Commit: Laslo Hunhold <dev_AT_frign.de>
CommitDate: Tue Jul 4 21:01:44 2017 +0200

    byte-range: fix range check for upper limit
    
    the range check was done after the check lower > upper
    so if it meets these conditions: lower <= upper and
    lower > st.st_size then lower could still be > upper.

diff --git a/quark.c b/quark.c
index d05385c..7408fc8 100644
--- a/quark.c
+++ b/quark.c
_AT_@ -667,10 +667,10 @@ sendresponse(int fd, struct request *r)
                 }
 
                 /* sanitize range */
+ upper = MIN(st.st_size, upper);
                 if (lower < 0 || upper < 0 || lower > upper) {
                         return sendstatus(fd, S_BAD_REQUEST);
                 }
- upper = MIN(st.st_size, upper);
         }
 
         /* mime */
Received on Tue Jul 04 2017 - 21:03:52 CEST

This archive was generated by hypermail 2.3.0 : Tue Jul 04 2017 - 21:12:36 CEST