Explain cli_iscontained

git-svn: trunk@1861
remotes/push_mirror/metadata
Nigel Horne 19 years ago
parent 613453180e
commit 9c29118651
  1. 9
      clamav-devel/libclamav/others.h

@ -23,6 +23,15 @@
#include <stdlib.h>
#include "cltypes.h"
/*
* CLI_ISCONTAINED(buf1, size1, buf2, size2) checks if buf2 is contained
* within buf1.
*
* buf1 and buf2 are pointers (or offsets) for the main buffer and the
* sub-buffer respectively, and size1/2 are their sizes
*
* The macro can be used to protect against wraps.
*/
#define CLI_ISCONTAINED(bb, bb_size, sb, sb_size) \
(bb_size > 0 && sb_size > 0 && sb_size <= bb_size \
&& sb >= bb && sb + sb_size <= bb + bb_size && sb + sb_size > bb)

Loading…
Cancel
Save