FreeBSD src
Go to file
Colin Percival c6a96a8441 Give a less silly response to a silly request.
Prior to this commit, fread/fwrite calls with size * nmemb > SIZE_MAX
were handled by reading or writing (size_t)(size * nmemb) bytes; for
example, on 32-bit platforms, fread(ptr, 641, 6700417, f) would read 1
byte and indicate that the requested 6700417 blocks had been read.

This commit adds a check for such integer overflows, and treats them as
if an overly large request was passed to read/write; i.e., it sets errno
to EINVAL, sets the error indicator on the file, and returns a short
object count (0, to be specific).

The overflow check involves an integer division, so as a performance
optimization we check first to see if both size and nmemb are less than
2^16; if they are, no overflow is possible and we avoid the division.
We assume here that size_t is at least 32 bits; this appears to be true
on all platforms FreeBSD supports.

Although this commit fixes an integer overflow, it is not likely to have
any security implications, since any program which would be affected by
this bug fix is quite clearly already very confused.

Reviewed by:	kib
MFC after:	1 month
2010-01-10 14:30:30 +00:00
bin Committed the wrong version in r201484. This time really fix the "-t" 2010-01-04 10:50:17 +00:00
cddl Apply OpenSolaris revision 8012 which brings our zpool to version 14, 2009-12-28 22:15:11 +00:00
contrib Apply patches directly to sources. Their effect is as follows: 2010-01-10 08:02:07 +00:00
crypto The size of credential messages is limited by CMGROUP_MAX rather than 2010-01-03 20:45:49 +00:00
etc The client type rule allows DHCP, implicitly. Since DHCPv6 uses 2010-01-09 19:16:27 +00:00
games For the now-infamous Rumsfeld quote: 2010-01-07 23:30:10 +00:00
gnu Merge r195030 from project/mips into head by hand: 2010-01-08 23:11:23 +00:00
include Move scandir(3) and alphasort(3) into XSI namespace. 2010-01-05 20:17:13 +00:00
kerberos5 Fix a typo. 2010-01-09 18:53:03 +00:00
lib Give a less silly response to a silly request. 2010-01-10 14:30:30 +00:00
libexec Make WARNS=6 the default for libexec/. 2010-01-02 09:50:19 +00:00
release sk(4), stge(4) and vge(4) should work on all architectures, snd_t4dwave(4) 2010-01-08 20:38:41 +00:00
rescue Unbreak rescue(8). We should also link against libulog now. 2009-12-05 23:23:46 +00:00
sbin Add some error messages suggested in PR bin/138043. The code to 2010-01-07 01:10:49 +00:00
secure Build lib/ with WARNS=6 by default. 2010-01-02 09:58:07 +00:00
share libusb20 was renamed libusb several months ago. 2010-01-09 18:55:29 +00:00
sys Correct a typo. 2010-01-10 12:03:53 +00:00
tools Update files to remove when MK_BLUETOOTH=no. 2010-01-09 19:52:42 +00:00
usr.bin Apply patches directly to sources. Their effect is as follows: 2010-01-10 08:02:07 +00:00
usr.sbin Add missing library dependency. 2010-01-09 18:59:03 +00:00
COPYRIGHT Happy New Year 2010! :-) 2009-12-31 10:00:37 +00:00
LOCKS Update LOCKS syntax. 2008-06-05 19:47:58 +00:00
MAINTAINERS Removing pre-commit review on isp(4). It's time to let people have their 2009-12-30 14:41:02 +00:00
Makefile Use uname -m [1] and rename BUILD_ARCH to XMACHINE[2]. 2010-01-09 23:37:29 +00:00
Makefile.inc1 Disable K&R style function definitions for WARNS=6. 2009-12-31 00:07:26 +00:00
ObsoleteFiles.inc Use umtx to implement process sharable semaphore, to make this work, 2010-01-05 02:37:59 +00:00
README Flatten out vendor tree. 2010-01-09 22:31:11 +00:00
UPDATING Introduce the new kernel thread called "deadlock resolver". 2010-01-09 01:46:38 +00:00

This is the top level of the FreeBSD source directory.  This file
was last revised on:
$FreeBSD$

For copyright information, please see the file COPYRIGHT in this
directory (additional copyright information also exists for some
sources in this tree - please see the specific source directories for
more information).

The Makefile in this directory supports a number of targets for
building components (or all) of the FreeBSD source tree, the most
commonly used one being ``world'', which rebuilds and installs
everything in the FreeBSD system from the source tree except the
kernel, the kernel-modules and the contents of /etc.  The ``world''
target should only be used in cases where the source tree has not
changed from the currently running version.  See:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html
for more information, including setting make(1) variables.

The ``buildkernel'' and ``installkernel'' targets build and install
the kernel and the modules (see below).  Please see the top of
the Makefile in this directory for more information on the
standard build targets and compile-time flags.

Building a kernel is a somewhat more involved process, documentation
for which can be found at:
   http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html
And in the config(8) man page.
Note: If you want to build and install the kernel with the
``buildkernel'' and ``installkernel'' targets, you might need to build
world before.  More information is available in the handbook.

The sample kernel configuration files reside in the sys/<arch>/conf
sub-directory (assuming that you've installed the kernel sources), the
file named GENERIC being the one used to build your initial installation
kernel.  The file NOTES contains entries and documentation for all possible
devices, not just those commonly used.  It is the successor of the ancient
LINT file, but in contrast to LINT, it is not buildable as a kernel but a
pure reference and documentation file.


Source Roadmap:
---------------
bin		System/user commands.

contrib		Packages contributed by 3rd parties.

crypto		Cryptography stuff (see crypto/README).

etc		Template files for /etc.

games		Amusements.

gnu		Various commands and libraries under the GNU Public License.
		Please see gnu/COPYING* for more information.

include		System include files.

kerberos5	Kerberos5 (Heimdal) package.

lib		System libraries.

libexec		System daemons.

release		Release building Makefile & associated tools.

rescue		Build system for statically linked /rescue utilities.

sbin		System commands.

secure		Cryptographic libraries and commands.

share		Shared resources.

sys		Kernel sources.

tools		Utilities for regression testing and miscellaneous tasks.

usr.bin		User commands.

usr.sbin	System administration commands.


For information on synchronizing your source tree with one or more of
the FreeBSD Project's development branches, please see:

  http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/synching.html