clamav/libclamav/regex
Micah Snyder 8e04c25fec Rename clamav memory allocation functions
We have some special functions to wrap malloc, calloc, and realloc to
make sure we don't allocate more than some limit, similar to the
max-filesize and max-scansize limits. Our wrappers are really only
needed when allocating memory for scans based on untrusted user input,
where a scan file could have bytes that claim you need to allocate
some ridiculous amount of memory. Right now they're named:
- cli_malloc
- cli_calloc
- cli_realloc
- cli_realloc2

... and these names do not convey their purpose

This commit renames them to:
- cli_max_malloc
- cli_max_calloc
- cli_max_realloc
- cli_max_realloc2

The realloc ones also have an additional feature in that they will not
free your pointer if you try to realloc to 0 bytes. Freeing the memory
is undefined by the C spec, and only done with some realloc
implementations, so this stabilizes on the behavior of not doing that,
which should prevent accidental double-free's.

So for the case where you may want to realloc and do not need to have a
maximum, this commit adds the following functions:
- cli_safer_realloc
- cli_safer_realloc2

These are used for the MPOOL_REALLOC and MPOOL_REALLOC2 macros when
MPOOL is disabled (e.g. because mmap-support is not found), so as to
match the behavior in the mpool_realloc/2 functions that do not make use
of the allocation-limit.
2024-03-15 13:18:47 -04:00
..
cclass.h regex - Update internal regex to latest version 2022-05-01 12:24:19 -07:00
cname.h regex - Update internal regex to latest version 2022-05-01 12:24:19 -07:00
engine.c Rename clamav memory allocation functions 2024-03-15 13:18:47 -04:00
regcomp.c Rename clamav memory allocation functions 2024-03-15 13:18:47 -04:00
regerror.c Single commit to add clam mods to regex code 2022-05-01 12:24:19 -07:00
regex.h fix compiler warning 2009-05-15 12:11:05 +00:00
regex2.h Single commit to add clam mods to regex code 2022-05-01 12:24:19 -07:00
regexec.c Rename clamav memory allocation functions 2024-03-15 13:18:47 -04:00
regfree.c Single commit to add clam mods to regex code 2022-05-01 12:24:19 -07:00
strlcpy.c Add strlcat functionality. Rely on existing strlcat and strlcpy if they are available. 2014-12-11 18:13:17 -05:00
utils.h Single commit to add clam mods to regex code 2022-05-01 12:24:19 -07:00