hc
2024-03-22 a0752693d998599af469473b8dc239ef973a012f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From 37ad222868e52271905b94afea4fc780d83294b4 Mon Sep 17 00:00:00 2001
From: Frank Denis <github@pureftpd.org>
Date: Tue, 23 Nov 2021 18:53:34 +0100
Subject: [PATCH] Initialize the max upload file size when quotas are enabled
 
Due to an unwanted check, files causing the quota to be exceeded
were deleted after the upload, but not during the upload.
 
The bug was introduced in 2009 in version 1.0.23
 
Spotted by @DroidTest, thanks!
 
[Retrieved from:
https://github.com/jedisct1/pure-ftpd/commit/37ad222868e52271905b94afea4fc780d83294b4]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 src/ftpd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
 
diff --git a/src/ftpd.c b/src/ftpd.c
index d856839..be2fd78 100644
--- a/src/ftpd.c
+++ b/src/ftpd.c
@@ -4247,8 +4247,7 @@ void dostor(char *name, const int append, const int autorename)
     if (quota_update(&quota, 0LL, 0LL, &overflow) == 0 &&
         (overflow > 0 || quota.files >= user_quota_files ||
          quota.size > user_quota_size ||
-         (max_filesize >= (off_t) 0 &&
-          (max_filesize = user_quota_size - quota.size) < (off_t) 0))) {
+         (max_filesize = user_quota_size - quota.size) < (off_t) 0)) {
         overflow = 1;
         (void) close(f);
         goto afterquota;