micasnyd d70adcb8b0 Fix ability to disable filesize limit with libclamav C API
You should be able to disable the maxfilesize limit by setting it to
zero. When "disabled", ClamAV should defer to inherent limitations, which
at this time is INT_MAX - 2 bytes.

This works okay for ClamScan and ClamD because our option parser
converts max-filesize=0 to 4294967295 (4GB). But it is presently broken
for other applications using the libclamav C API, like this:
```c
  cl_engine_set_num(engine, CL_ENGINE_MAX_FILESIZE, 0);
```

The limit checks added for cl_scanmap_callback and cl_scanfile_callback
in 0.103.4 and 0.104.1 broke this ability because we forgot to check if
the `maxfilesize > 0` before enforcing it.

This commit adds that guard so you can disable by setting to `0`.

While working on this, I also found that the `max_size` variables in our
libmspack scanner code are using an `off_t` type, which is a SIGNED integer
that may be 32bit width even on some 64bit platforms, or may be a 64bit
width. AND the default `max_size` when `maxfilesize == 0` was being set to
UINT_MAX (0xffffffff), aka `-1` when `off_t` is 32bits.

This commit addresses this related issue by:
 - changing the `max_size` to use `uint64_t`, like our other limits.
 - verifying that `maxfilesize > 0` before using it.
 - checking that using `UINT32_MAX` as a backup will not exceed the
   max-scansize in the same way that we do with the maxfilesize.
2021-12-22 17:34:55 -07:00
2021-12-07 16:24:46 -08:00
2021-12-08 13:15:46 -07:00
2021-04-09 19:08:14 -07:00
2021-12-08 13:15:46 -07:00
2021-07-05 15:19:02 -07:00
2021-12-08 13:15:46 -07:00
2021-05-21 10:05:52 -07:00
2021-12-07 18:11:09 -08:00
2021-10-11 17:59:02 -07:00
2020-08-13 00:25:34 -07:00
2021-10-21 10:45:54 -07:00
2021-06-09 14:17:59 -07:00
2020-08-13 00:25:34 -07:00

ClamAV

Maeve, the ClamAV mascot

ClamAV® is an open source antivirus engine for detecting trojans, viruses, malware & other malicious threats.

Documentation & FAQ

ClamAV documentation is hosted at docs.clamav.net. The source archive for each release also includes a copy of the documentation for offline reading.

You can contribute to the documentation by submitting improvements to Cisco-Talos/clamav-documentation

ClamAV News

For information about the features in this and prior releases, read the news.

Catch up on the latest about ClamAV by reading our blog and follow us on Twitter @clamav.

ClamAV Signatures

Anyone can learn to read and write ClamAV signatures. To get started, see our signature writing manual.

Installation Instructions

Using Docker

ClamAV can be run using Docker. For details, visit to the online manual under "Docker" and check out our images on Docker Hub.

Using a Package Manager

For help installing from a package manager, refer to the online manual under "Packages".

Using an Installer

The following install packages are available for download from clamav.net/downloads:

  • Linux - Debian and RPM packages for x86_64 and i686. New in v0.104.
  • macOS - PKG installer for x86_64 and arm64 (universal). New in v0.104.
  • Windows - MSI installers and portable ZIP packages for win32 and x64.

To learn how to use these packages, refer to the online manual under "Installing".

Build from Source

For step-by-step instructions, refer to the online manual:

The source archive for each release includes a copy of the documentation for offline reading.

A reference with all of the available build options can be found in the INSTALL.md file.

You can find additional advice for developers in the online manual under "For Developers".

Upgrading from a previous version

Visit the FAQ for tips on how to upgrade from a previous version.

Join the ClamAV Community

The best way to get in touch with the ClamAV community is to join our mailing lists.

You can also join the community on our ClamAV Discord chat server.

Want to make a contribution?

The ClamAV development team welcomes code contributions, improvements to our documentation, and also bug reports.

Thanks for joining us!

Licensing

ClamAV is licensed for public/open source use under the GNU General Public License, Version 2 (GPLv2).

See COPYING.txt for a copy of the license.

3rd Party Code

ClamAV contains a number of components that include code copied in part or in whole from 3rd party projects and whose code is not owned by Cisco and which are licensed differently than ClamAV. These include:

  • tomsfastmath: public domain
  • Yara: Apache 2.0 license
    • Yara has since switched to the BSD 3-Clause License; Our source is out-of-date and needs to be updated.
  • 7z / lzma: public domain
  • libclamav's NSIS/NulSoft parser includes:
    • zlib: permissive free software license
    • bzip2 / libbzip2: BSD-like license
  • OpenBSD's libc/regex: BSD license
  • file: BSD license
  • str.c: Contains BSD licensed modified-implementations of strtol(), stroul() functions, Copyright (c) 1990 The Regents of the University of California.
  • pngcheck (png.c): MIT/X11-style license
  • getopt.c: MIT license
  • Curl: license inspired by MIT/X, but not identical
  • libmspack: LGPL license
  • UnRAR (libclamunrar): a non-free/restricted open source license
    • Note: The UnRAR license is incompatible with GPLv2 because it contains a clause that prohibits reverse engineering a RAR compression algorithm from the UnRAR decompression code. For this reason, libclamunrar/libclamunrar_iface is not linked at all with libclamav. It is instead loaded at run-time. If it fails to load, ClamAV will continue running without RAR support.

See the COPYING directory for a copy of the 3rd party project licenses.

Acknowledgements

Credit for contributions to each release can be found in the News.

ClamAV is brought to you by the ClamAV Team

Description
No description provided
Readme 214 MiB
Languages
C 80.4%
C++ 9.1%
Rust 3.6%
Python 3%
CMake 2.3%
Other 1.4%