You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2011/06/21 20:57:48 UTC

DO NOT REPLY [Bug 51412] New: Nasty warning in ftp_cmd_pbsz() -- dangerous, where long is not the same as int

https://issues.apache.org/bugzilla/show_bug.cgi?id=51412

             Bug #: 51412
           Summary: Nasty warning in ftp_cmd_pbsz() -- dangerous, where
                    long is not the same as int
           Product: Apache httpd-2
           Version: 2.2.15
          Platform: PC
        OS/Version: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_ftp
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: mi+apache@aldan.algebra.com
    Classification: Unclassified


Created attachment 27190
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=27190
Properly parse buffer-size

Building the module on my 64-bit machine, I get the following warning:

ftp_commands.c:1694: warning: comparison is always false due to limited range
of data type

Indeed, although ftp_connection's pbsz field is of type int, it is compared to
LONG_MAX.

The attached patch uses a private long variable to check the value supplied by
the client. Only if the value is positive and below INT_MAX is it assigned to
fc->pbsz.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 51412] Nasty warning in ftp_cmd_pbsz() -- dangerous, where long is not the same as int

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51412

--- Comment #2 from William A. Rowe Jr. <wr...@apache.org> 2011-06-22 21:00:57 UTC ---
Thanks Mikhail, reviewing your patch!

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 51412] Nasty warning in ftp_cmd_pbsz() -- dangerous, where long is not the same as int

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51412

Mikhail T. <mi...@aldan.algebra.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #27190|0                           |1
        is obsolete|                            |

--- Comment #1 from Mikhail T. <mi...@aldan.algebra.com> 2011-06-21 18:59:57 UTC ---
Created attachment 27191
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=27191
Properly parse buffer-size

This version ensures, the requested size is positive -- refusing size 0.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 51412] Nasty warning in ftp_cmd_pbsz() -- dangerous, where long is not the same as int

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51412

--- Comment #3 from Mikhail T. <mi...@aldan.algebra.com> 2011-06-22 21:16:25 UTC ---
BTW, even INT_MAX is far too much for a buffer-size. Perhaps, the maximum
allowed size should be a configuration option -- defaulting to something like
8192 or 16384?..

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 51412] Nasty warning in ftp_cmd_pbsz() -- dangerous, where long is not the same as int

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51412

Mikhail T. <mi...@aldan.algebra.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |PatchAvailable

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org