[prev in list] [next in list] [prev in thread] [next in thread] 

List:       proftpd-committers
Subject:    [ProFTPD-committers] proftpd/modules mod_xfer.c,1.333,1.334
From:       TJ Saunders <castaglia () users ! sourceforge ! net>
Date:       2014-04-28 17:11:20
Message-ID: E1Wep5N-00006N-FT () sfs-ml-1 ! v29 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Update of /cvsroot/proftp/proftpd/modules
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv30599/modules

Modified Files:
	mod_xfer.c 
Log Message:

Slightly better fix for Bug#4046; less chance of overflowing the
off_t datatype on filesystems with lots of free space.


Index: mod_xfer.c
===================================================================
RCS file: /cvsroot/proftp/proftpd/modules/mod_xfer.c,v
retrieving revision 1.333
retrieving revision 1.334
diff -u -d -r1.333 -r1.334
--- mod_xfer.c	28 Apr 2014 17:05:51 -0000	1.333
+++ mod_xfer.c	28 Apr 2014 17:11:18 -0000	1.334
@@ -2397,12 +2397,12 @@
 
   if (xfer_opts & PR_XFER_OPT_HANDLE_ALLO) {
     const char *path;
-    off_t avail_sz;
+    off_t avail_kb;
     int res;
 
     path = pr_fs_getcwd();
 
-    res = pr_fs_getsize2((char *) path, &avail_sz);
+    res = pr_fs_getsize2((char *) path, &avail_kb);
     if (res < 0) {
       /* If we can't check the filesystem stats for any reason, let the request
        * proceed anyway.
@@ -2413,14 +2413,17 @@
       pr_response_add(R_202, _("No storage allocation necessary"));
 
     } else {
+      off_t requested_kb;
 
       /* The requested size is in bytes; the size returned from
        * pr_fs_getsize2() is in KB.
        */
-      if (requested_sz > (avail_sz * 1024)) {
-        pr_log_debug(DEBUG5, "%s requested %" PR_LU " bytes, only %" PR_LU
-          " bytes available on '%s'", cmd->argv[0], (pr_off_t) requested_sz,
-          (pr_off_t) (avail_sz * 1024), path);
+      requested_kb = requested_sz / 1024;
+
+      if (requested_kb > avail_kb) {
+        pr_log_debug(DEBUG5, "%s requested %" PR_LU " KB, only %" PR_LU
+          " KB available on '%s'", cmd->argv[0], (pr_off_t) requested_kb,
+          (pr_off_t) avail_kb, path);
         pr_response_add_err(R_552, "%s: %s", cmd->arg, strerror(ENOSPC));
         return PR_ERROR(cmd);
       }


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
ProFTPD Committers Mailing List
proftpd-committers@proftpd.org
https://lists.sourceforge.net/lists/listinfo/proftp-committers
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic