mirror of
https://github.com/Cisco-Talos/clamav.git
synced 2025-10-19 10:23:17 +00:00
Clang-format touchup
This commit is contained in:
parent
0e5d3f97f1
commit
1e5ddefcee
29 changed files with 178 additions and 177 deletions
|
@ -212,7 +212,7 @@ struct client_parallel_data {
|
|||
unsigned int id;
|
||||
const char *file;
|
||||
struct SCANID *next;
|
||||
} * ids;
|
||||
} *ids;
|
||||
};
|
||||
|
||||
/* Sends a proper scan request to clamd and parses its replies
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include "scanners.h"
|
||||
#include "dconf.h"
|
||||
|
||||
//#define DEBUG_APM_PARSE
|
||||
// #define DEBUG_APM_PARSE
|
||||
|
||||
#ifdef DEBUG_APM_PARSE
|
||||
#define apm_parsemsg(...) cli_dbgmsg(__VA_ARGS__)
|
||||
|
|
|
@ -172,12 +172,12 @@ enum FunctionalityLevels {
|
|||
FUNC_LEVEL_1_0_4 = 164, /**< LibClamAV release 1.0.4 */
|
||||
FUNC_LEVEL_1_0_5 = 165, /**< LibClamAV release 1.0.5 */
|
||||
|
||||
FUNC_LEVEL_1_1 = 180, /**< LibClamAV release 1.1.0 */
|
||||
FUNC_LEVEL_1_1 = 180, /**< LibClamAV release 1.1.0 */
|
||||
FUNC_LEVEL_1_1_1 = 181, /**< LibClamAV release 1.1.1 */
|
||||
FUNC_LEVEL_1_1_2 = 182, /**< LibClamAV release 1.1.2 */
|
||||
FUNC_LEVEL_1_1_3 = 183, /**< LibClamAV release 1.1.3 */
|
||||
|
||||
FUNC_LEVEL_1_2 = 190, /**< LibClamAV release 1.2.0 */
|
||||
FUNC_LEVEL_1_2 = 190, /**< LibClamAV release 1.2.0 */
|
||||
FUNC_LEVEL_1_2_1 = 191, /**< LibClamAV release 1.2.1 */
|
||||
FUNC_LEVEL_1_2_2 = 192, /**< LibClamAV release 1.2.2 */
|
||||
|
||||
|
|
|
@ -286,17 +286,17 @@ static always_inline struct stack_entry *pop_stack(struct stack *stack,
|
|||
*(uint8_t *)&values[p] = x
|
||||
#define WRITE16(p, x) \
|
||||
CHECK_GT(func->numBytes, p + 1); \
|
||||
CHECK_EQ((p) & 1, 0); \
|
||||
CHECK_EQ((p)&1, 0); \
|
||||
TRACE_W(x, p, 16); \
|
||||
*(uint16_t *)&values[p] = x
|
||||
#define WRITE32(p, x) \
|
||||
CHECK_GT(func->numBytes, p + 3); \
|
||||
CHECK_EQ((p) & 3, 0); \
|
||||
CHECK_EQ((p)&3, 0); \
|
||||
TRACE_W(x, p, 32); \
|
||||
*(uint32_t *)&values[p] = x
|
||||
#define WRITE64(p, x) \
|
||||
CHECK_GT(func->numBytes, p + 7); \
|
||||
CHECK_EQ((p) & 7, 0); \
|
||||
CHECK_EQ((p)&7, 0); \
|
||||
TRACE_W(x, p, 64); \
|
||||
*(uint64_t *)&values[p] = x
|
||||
#define WRITEP(x, p) \
|
||||
|
@ -346,16 +346,16 @@ static always_inline struct stack_entry *pop_stack(struct stack *stack,
|
|||
} \
|
||||
TRACE_R(x) \
|
||||
}
|
||||
#define READPOP(x, p, asize) \
|
||||
{ \
|
||||
if ((p) & 0x40000000) { \
|
||||
unsigned ptr__ = (p) & 0xbfffffff; \
|
||||
CHECK_GT(func->numBytes, ptr__); \
|
||||
TRACE_PTR(ptr__, asize); \
|
||||
x = (void *)&values[ptr__]; \
|
||||
} else { \
|
||||
READP(x, p, asize) \
|
||||
} \
|
||||
#define READPOP(x, p, asize) \
|
||||
{ \
|
||||
if ((p)&0x40000000) { \
|
||||
unsigned ptr__ = (p)&0xbfffffff; \
|
||||
CHECK_GT(func->numBytes, ptr__); \
|
||||
TRACE_PTR(ptr__, asize); \
|
||||
x = (void *)&values[ptr__]; \
|
||||
} else { \
|
||||
READP(x, p, asize) \
|
||||
} \
|
||||
}
|
||||
|
||||
#define READOLD8(x, p) \
|
||||
|
@ -364,17 +364,17 @@ static always_inline struct stack_entry *pop_stack(struct stack *stack,
|
|||
TRACE_R(x)
|
||||
#define READOLD16(x, p) \
|
||||
CHECK_GT(func->numBytes, p + 1); \
|
||||
CHECK_EQ((p) & 1, 0); \
|
||||
CHECK_EQ((p)&1, 0); \
|
||||
x = *(uint16_t *)&old_values[p]; \
|
||||
TRACE_R(x)
|
||||
#define READOLD32(x, p) \
|
||||
CHECK_GT(func->numBytes, p + 3); \
|
||||
CHECK_EQ((p) & 3, 0); \
|
||||
CHECK_EQ((p)&3, 0); \
|
||||
x = *(uint32_t *)&old_values[p]; \
|
||||
TRACE_R(x)
|
||||
#define READOLD64(x, p) \
|
||||
CHECK_GT(func->numBytes, p + 7); \
|
||||
CHECK_EQ((p) & 7, 0); \
|
||||
CHECK_EQ((p)&7, 0); \
|
||||
x = *(uint64_t *)&old_values[p]; \
|
||||
TRACE_R(x)
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ void LLVMInitializePowerPCAsmPrinter();
|
|||
|
||||
#include "llvm/IR/Dominators.h"
|
||||
|
||||
//#define TIMING
|
||||
// #define TIMING
|
||||
#undef TIMING
|
||||
|
||||
#include "llvm/Config/llvm-config.h"
|
||||
|
|
|
@ -398,7 +398,7 @@ static cl_error_t crtmgr_get_recov_data(BIGNUM *sig, cli_crt *x509,
|
|||
int pad_size;
|
||||
int keylen;
|
||||
uint8_t *d = NULL;
|
||||
BIGNUM *x = NULL;
|
||||
BIGNUM *x = NULL;
|
||||
cl_error_t ret;
|
||||
|
||||
*buffer = NULL;
|
||||
|
|
|
@ -1222,9 +1222,9 @@ static cl_error_t egg_parse_file_extra_field(egg_handle* handle, egg_file* eggFi
|
|||
* Comment found. Add comment to our list.
|
||||
*/
|
||||
CLI_SAFER_REALLOC_OR_GOTO_DONE(eggFile->comments,
|
||||
sizeof(char*) * (eggFile->nComments + 1),
|
||||
free(comment),
|
||||
status = CL_EMEM);
|
||||
sizeof(char*) * (eggFile->nComments + 1),
|
||||
free(comment),
|
||||
status = CL_EMEM);
|
||||
eggFile->comments[eggFile->nComments] = comment;
|
||||
eggFile->nComments++;
|
||||
}
|
||||
|
@ -1668,9 +1668,9 @@ cl_error_t cli_egg_open(fmap_t* map, void** hArchive, char*** comments, uint32_t
|
|||
} else {
|
||||
/* Add file to list. */
|
||||
CLI_SAFER_REALLOC_OR_GOTO_DONE(handle->files,
|
||||
sizeof(egg_file*) * (handle->nFiles + 1),
|
||||
egg_free_egg_file(found_file),
|
||||
status = CL_EMEM);
|
||||
sizeof(egg_file*) * (handle->nFiles + 1),
|
||||
egg_free_egg_file(found_file),
|
||||
status = CL_EMEM);
|
||||
handle->files[handle->nFiles] = found_file;
|
||||
handle->nFiles++;
|
||||
}
|
||||
|
@ -1690,9 +1690,9 @@ cl_error_t cli_egg_open(fmap_t* map, void** hArchive, char*** comments, uint32_t
|
|||
/* Add block to list. */
|
||||
if (handle->bSolid) {
|
||||
CLI_SAFER_REALLOC_OR_GOTO_DONE(handle->blocks,
|
||||
sizeof(egg_block*) * (handle->nBlocks + 1),
|
||||
egg_free_egg_block(found_block),
|
||||
status = CL_EMEM);
|
||||
sizeof(egg_block*) * (handle->nBlocks + 1),
|
||||
egg_free_egg_block(found_block),
|
||||
status = CL_EMEM);
|
||||
handle->blocks[handle->nBlocks] = found_block;
|
||||
handle->nBlocks++;
|
||||
} else {
|
||||
|
@ -1708,9 +1708,9 @@ cl_error_t cli_egg_open(fmap_t* map, void** hArchive, char*** comments, uint32_t
|
|||
eggFile = handle->files[handle->nFiles - 1];
|
||||
|
||||
CLI_SAFER_REALLOC_OR_GOTO_DONE(eggFile->blocks,
|
||||
sizeof(egg_block*) * (eggFile->nBlocks + 1),
|
||||
egg_free_egg_block(found_block),
|
||||
status = CL_EMEM);
|
||||
sizeof(egg_block*) * (eggFile->nBlocks + 1),
|
||||
egg_free_egg_block(found_block),
|
||||
status = CL_EMEM);
|
||||
eggFile->blocks[eggFile->nBlocks] = found_block;
|
||||
eggFile->nBlocks++;
|
||||
}
|
||||
|
@ -1786,9 +1786,9 @@ cl_error_t cli_egg_open(fmap_t* map, void** hArchive, char*** comments, uint32_t
|
|||
* Comment found. Add comment to our list.
|
||||
*/
|
||||
CLI_SAFER_REALLOC_OR_GOTO_DONE(handle->comments,
|
||||
sizeof(char*) * (handle->nComments + 1),
|
||||
free(comment),
|
||||
status = CL_EMEM);
|
||||
sizeof(char*) * (handle->nComments + 1),
|
||||
free(comment),
|
||||
status = CL_EMEM);
|
||||
handle->comments[handle->nComments] = comment;
|
||||
handle->nComments++;
|
||||
}
|
||||
|
@ -1973,9 +1973,9 @@ cl_error_t cli_egg_deflate_decompress(char* compressed, size_t compressed_size,
|
|||
/* extend output capacity if needed,*/
|
||||
if (stream.avail_out == 0) {
|
||||
CLI_SAFER_REALLOC_OR_GOTO_DONE(decoded,
|
||||
capacity + BUFSIZ,
|
||||
cli_errmsg("cli_egg_deflate_decompress: cannot reallocate memory for decompressed output\n"),
|
||||
status = CL_EMEM);
|
||||
capacity + BUFSIZ,
|
||||
cli_errmsg("cli_egg_deflate_decompress: cannot reallocate memory for decompressed output\n"),
|
||||
status = CL_EMEM);
|
||||
stream.next_out = decoded + capacity;
|
||||
stream.avail_out = BUFSIZ;
|
||||
declen += BUFSIZ;
|
||||
|
@ -2095,9 +2095,9 @@ cl_error_t cli_egg_bzip2_decompress(char* compressed, size_t compressed_size, ch
|
|||
/* extend output capacity if needed,*/
|
||||
if (stream.avail_out == 0) {
|
||||
CLI_SAFER_REALLOC_OR_GOTO_DONE(decoded,
|
||||
capacity + BUFSIZ,
|
||||
cli_errmsg("cli_egg_bzip2_decompress: cannot reallocate memory for decompressed output\n");
|
||||
status = CL_EMEM);
|
||||
capacity + BUFSIZ,
|
||||
cli_errmsg("cli_egg_bzip2_decompress: cannot reallocate memory for decompressed output\n");
|
||||
status = CL_EMEM);
|
||||
stream.next_out = decoded + capacity;
|
||||
stream.avail_out = BUFSIZ;
|
||||
declen += BUFSIZ;
|
||||
|
@ -2212,9 +2212,9 @@ cl_error_t cli_egg_lzma_decompress(char* compressed, size_t compressed_size, cha
|
|||
/* extend output capacity if needed,*/
|
||||
if (stream.avail_out == 0) {
|
||||
CLI_SAFER_REALLOC_OR_GOTO_DONE(decoded,
|
||||
capacity + BUFSIZ,
|
||||
cli_errmsg("cli_egg_lzma_decompress: cannot reallocate memory for decompressed output\n");
|
||||
status = CL_EMEM);
|
||||
capacity + BUFSIZ,
|
||||
cli_errmsg("cli_egg_lzma_decompress: cannot reallocate memory for decompressed output\n");
|
||||
status = CL_EMEM);
|
||||
stream.next_out = decoded + capacity;
|
||||
stream.avail_out = BUFSIZ;
|
||||
declen += BUFSIZ;
|
||||
|
@ -2362,10 +2362,10 @@ cl_error_t cli_egg_extract_file(void* hArchive, const char** filename, const cha
|
|||
}
|
||||
|
||||
CLI_SAFER_REALLOC_OR_GOTO_DONE(decompressed,
|
||||
(size_t)decompressed_size + currBlock->blockHeader->compress_size,
|
||||
cli_errmsg("cli_egg_extract_file: Failed to allocate %" PRIu64 " bytes for decompressed file!\n",
|
||||
decompressed_size),
|
||||
status = CL_EMEM);
|
||||
(size_t)decompressed_size + currBlock->blockHeader->compress_size,
|
||||
cli_errmsg("cli_egg_extract_file: Failed to allocate %" PRIu64 " bytes for decompressed file!\n",
|
||||
decompressed_size),
|
||||
status = CL_EMEM);
|
||||
|
||||
memcpy(decompressed + decompressed_size, currBlock->compressedData, currBlock->blockHeader->compress_size);
|
||||
decompressed_size += currBlock->blockHeader->compress_size;
|
||||
|
@ -2387,11 +2387,11 @@ cl_error_t cli_egg_extract_file(void* hArchive, const char** filename, const cha
|
|||
}
|
||||
/* Decompressed block. Add it to the file data */
|
||||
CLI_SAFER_REALLOC_OR_GOTO_DONE(decompressed,
|
||||
(size_t)decompressed_size + decompressed_block_size,
|
||||
cli_errmsg("cli_egg_extract_file: Failed to allocate %" PRIu64 " bytes for decompressed file!\n",
|
||||
decompressed_size),
|
||||
free(decompressed_block),
|
||||
status = CL_EMEM);
|
||||
(size_t)decompressed_size + decompressed_block_size,
|
||||
cli_errmsg("cli_egg_extract_file: Failed to allocate %" PRIu64 " bytes for decompressed file!\n",
|
||||
decompressed_size),
|
||||
free(decompressed_block),
|
||||
status = CL_EMEM);
|
||||
|
||||
memcpy(decompressed + decompressed_size, decompressed_block, decompressed_block_size);
|
||||
decompressed_size += decompressed_block_size;
|
||||
|
@ -2416,11 +2416,11 @@ cl_error_t cli_egg_extract_file(void* hArchive, const char** filename, const cha
|
|||
}
|
||||
/* Decompressed block. Add it to the file data */
|
||||
CLI_SAFER_REALLOC_OR_GOTO_DONE(decompressed,
|
||||
(size_t)decompressed_size + decompressed_block_size,
|
||||
cli_errmsg("cli_egg_extract_file: Failed to allocate %" PRIu64 " bytes for decompressed file!\n",
|
||||
decompressed_size),
|
||||
free(decompressed_block),
|
||||
status = CL_EMEM);
|
||||
(size_t)decompressed_size + decompressed_block_size,
|
||||
cli_errmsg("cli_egg_extract_file: Failed to allocate %" PRIu64 " bytes for decompressed file!\n",
|
||||
decompressed_size),
|
||||
free(decompressed_block),
|
||||
status = CL_EMEM);
|
||||
|
||||
memcpy(decompressed + decompressed_size, decompressed_block, decompressed_block_size);
|
||||
decompressed_size += decompressed_block_size;
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
typedef struct {
|
||||
enum encodings encoding;
|
||||
size_t size;
|
||||
} * iconv_t;
|
||||
}* iconv_t;
|
||||
#endif
|
||||
|
||||
static unsigned char tohex[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
|
||||
|
|
|
@ -41,8 +41,8 @@
|
|||
#include "scanners.h"
|
||||
#include "dconf.h"
|
||||
|
||||
//#define DEBUG_GPT_PARSE
|
||||
//#define DEBUG_GPT_PRINT
|
||||
// #define DEBUG_GPT_PARSE
|
||||
// #define DEBUG_GPT_PRINT
|
||||
|
||||
#ifdef DEBUG_GPT_PARSE
|
||||
#define gpt_parsemsg(...) cli_dbgmsg(__VA_ARGS__)
|
||||
|
|
|
@ -372,18 +372,18 @@ void html_tag_arg_add(tag_arguments_t *tags,
|
|||
int len, i;
|
||||
tags->count++;
|
||||
tags->tag = (unsigned char **)cli_max_realloc_or_free(tags->tag,
|
||||
tags->count * sizeof(char *));
|
||||
tags->count * sizeof(char *));
|
||||
if (!tags->tag) {
|
||||
goto done;
|
||||
}
|
||||
tags->value = (unsigned char **)cli_max_realloc_or_free(tags->value,
|
||||
tags->count * sizeof(char *));
|
||||
tags->count * sizeof(char *));
|
||||
if (!tags->value) {
|
||||
goto done;
|
||||
}
|
||||
if (tags->scanContents) {
|
||||
tags->contents = (unsigned char **)cli_max_realloc_or_free(tags->contents,
|
||||
tags->count * sizeof(*tags->contents));
|
||||
tags->count * sizeof(*tags->contents));
|
||||
if (!tags->contents) {
|
||||
goto done;
|
||||
}
|
||||
|
|
|
@ -358,7 +358,7 @@ struct IS_CABSTUFF {
|
|||
unsigned int cabno;
|
||||
off_t off;
|
||||
size_t sz;
|
||||
} * cabs;
|
||||
} *cabs;
|
||||
off_t hdr;
|
||||
size_t hdrsz;
|
||||
unsigned int cabcnt;
|
||||
|
|
|
@ -313,7 +313,7 @@ cl_error_t cli_parsejpeg(cli_ctx *ctx)
|
|||
{
|
||||
cl_error_t status = CL_SUCCESS;
|
||||
|
||||
fmap_t *map = NULL;
|
||||
fmap_t *map = NULL;
|
||||
jpeg_marker_t marker = JPEG_MARKER_NOT_A_MARKER_0x00, prev_marker, prev_segment = JPEG_MARKER_NOT_A_MARKER_0x00;
|
||||
uint8_t buff[50]; /* 50 should be sufficient for now */
|
||||
uint16_t len_u16;
|
||||
|
|
|
@ -67,7 +67,7 @@ typedef struct scanner {
|
|||
size_t lastpos;
|
||||
enum tokenizer_state state;
|
||||
enum tokenizer_state last_state;
|
||||
} * yyscan_t;
|
||||
} *yyscan_t;
|
||||
|
||||
static int yylex(YYSTYPE *lvalp, yyscan_t);
|
||||
static void yy_scan_bytes(const char *, size_t, yyscan_t scanner);
|
||||
|
|
|
@ -162,7 +162,7 @@ typedef enum {
|
|||
* Slows things down a lot and only catches unencoded copies
|
||||
* of EICAR within bounces, which don't matter
|
||||
*/
|
||||
//#define SCAN_UNENCODED_BOUNCES
|
||||
// #define SCAN_UNENCODED_BOUNCES
|
||||
|
||||
typedef struct mbox_ctx {
|
||||
const char *dir;
|
||||
|
@ -265,7 +265,7 @@ static bool haveTooManyMIMEArguments(size_t argCnt, cli_ctx *ctx, bool *heuristi
|
|||
* protocol="application/pgp-encrypted" \
|
||||
*/
|
||||
#define X_BFILE RELATED /* \
|
||||
* BeOS, expert two parts: the file and its \
|
||||
* BeOS, expert two parts: the file and its \
|
||||
* attributes. The attributes part comes as \
|
||||
* Content-Type: application/x-be_attribute \
|
||||
* name="foo" \
|
||||
|
|
|
@ -38,8 +38,8 @@
|
|||
#include "scanners.h"
|
||||
#include "dconf.h"
|
||||
|
||||
//#define DEBUG_MBR_PARSE
|
||||
//#define DEBUG_EBR_PARSE
|
||||
// #define DEBUG_MBR_PARSE
|
||||
// #define DEBUG_EBR_PARSE
|
||||
|
||||
#ifdef DEBUG_MBR_PARSE
|
||||
#define mbr_parsemsg(...) cli_dbgmsg(__VA_ARGS__)
|
||||
|
|
|
@ -197,7 +197,7 @@ int ole2_list_push(ole2_list_t *list, uint32_t val)
|
|||
int status = CL_EMEM;
|
||||
|
||||
CLI_MALLOC_OR_GOTO_DONE(new_node, sizeof(ole2_list_node_t),
|
||||
cli_dbgmsg("OLE2: could not allocate new node for worklist!\n"));
|
||||
cli_dbgmsg("OLE2: could not allocate new node for worklist!\n"));
|
||||
|
||||
new_node->Val = val;
|
||||
new_node->Next = list->Head;
|
||||
|
@ -257,7 +257,7 @@ cli_ole2_get_property_name2(const char *name, int size)
|
|||
return NULL;
|
||||
}
|
||||
CLI_MAX_MALLOC_OR_GOTO_DONE(newname, size * 7,
|
||||
cli_errmsg("OLE2 [cli_ole2_get_property_name2]: Unable to allocate memory for newname: %u\n", size * 7));
|
||||
cli_errmsg("OLE2 [cli_ole2_get_property_name2]: Unable to allocate memory for newname: %u\n", size * 7));
|
||||
|
||||
j = 0;
|
||||
/* size-2 to ignore trailing NULL */
|
||||
|
@ -305,7 +305,7 @@ get_property_name(char *name, int size)
|
|||
}
|
||||
|
||||
CLI_MAX_MALLOC_OR_GOTO_DONE(newname, size,
|
||||
cli_errmsg("OLE2 [get_property_name]: Unable to allocate memory for newname %u\n", size));
|
||||
cli_errmsg("OLE2 [get_property_name]: Unable to allocate memory for newname %u\n", size));
|
||||
cname = newname;
|
||||
|
||||
while (--csize) {
|
||||
|
@ -889,8 +889,8 @@ static cl_error_t handler_writefile(ole2_header_t *hdr, property_t *prop, const
|
|||
len = prop->size;
|
||||
|
||||
CLI_MAX_MALLOC_OR_GOTO_DONE(buff, 1 << hdr->log2_big_block_size,
|
||||
cli_errmsg("OLE2 [handler_writefile]: Unable to allocate memory for buff: %u\n", 1 << hdr->log2_big_block_size);
|
||||
ret = CL_EMEM);
|
||||
cli_errmsg("OLE2 [handler_writefile]: Unable to allocate memory for buff: %u\n", 1 << hdr->log2_big_block_size);
|
||||
ret = CL_EMEM);
|
||||
|
||||
blk_bitset = cli_bitset_init();
|
||||
if (!blk_bitset) {
|
||||
|
@ -1158,8 +1158,8 @@ static cl_error_t scan_for_xlm_macros_and_images(ole2_header_t *hdr, property_t
|
|||
len = prop->size;
|
||||
|
||||
CLI_MAX_MALLOC_OR_GOTO_DONE(buff, 1 << hdr->log2_big_block_size,
|
||||
cli_errmsg("OLE2 [scan_for_xlm_macros_and_images]: Unable to allocate memory for buff: %u\n", 1 << hdr->log2_big_block_size);
|
||||
status = CL_EMEM);
|
||||
cli_errmsg("OLE2 [scan_for_xlm_macros_and_images]: Unable to allocate memory for buff: %u\n", 1 << hdr->log2_big_block_size);
|
||||
status = CL_EMEM);
|
||||
|
||||
blk_bitset = cli_bitset_init();
|
||||
if (!blk_bitset) {
|
||||
|
|
|
@ -593,16 +593,16 @@ extern LIBCLAMAV_EXPORT int have_rar;
|
|||
|
||||
/* based on macros from A. Melnikoff */
|
||||
#define cbswap16(v) (((v & 0xff) << 8) | (((v) >> 8) & 0xff))
|
||||
#define cbswap32(v) ((((v) & 0x000000ff) << 24) | (((v) & 0x0000ff00) << 8) | \
|
||||
(((v) & 0x00ff0000) >> 8) | (((v) & 0xff000000) >> 24))
|
||||
#define cbswap64(v) ((((v) & 0x00000000000000ffULL) << 56) | \
|
||||
(((v) & 0x000000000000ff00ULL) << 40) | \
|
||||
(((v) & 0x0000000000ff0000ULL) << 24) | \
|
||||
(((v) & 0x00000000ff000000ULL) << 8) | \
|
||||
(((v) & 0x000000ff00000000ULL) >> 8) | \
|
||||
(((v) & 0x0000ff0000000000ULL) >> 24) | \
|
||||
(((v) & 0x00ff000000000000ULL) >> 40) | \
|
||||
(((v) & 0xff00000000000000ULL) >> 56))
|
||||
#define cbswap32(v) ((((v)&0x000000ff) << 24) | (((v)&0x0000ff00) << 8) | \
|
||||
(((v)&0x00ff0000) >> 8) | (((v)&0xff000000) >> 24))
|
||||
#define cbswap64(v) ((((v)&0x00000000000000ffULL) << 56) | \
|
||||
(((v)&0x000000000000ff00ULL) << 40) | \
|
||||
(((v)&0x0000000000ff0000ULL) << 24) | \
|
||||
(((v)&0x00000000ff000000ULL) << 8) | \
|
||||
(((v)&0x000000ff00000000ULL) >> 8) | \
|
||||
(((v)&0x0000ff0000000000ULL) >> 24) | \
|
||||
(((v)&0x00ff000000000000ULL) >> 40) | \
|
||||
(((v)&0xff00000000000000ULL) >> 56))
|
||||
|
||||
#ifndef HAVE_ATTRIB_PACKED
|
||||
#define __attribute__(x)
|
||||
|
@ -828,8 +828,8 @@ size_t cli_recursion_stack_get_size(cli_ctx *ctx, int index);
|
|||
/* used by: spin, yc (C) aCaB */
|
||||
#define __SHIFTBITS(a) (sizeof(a) << 3)
|
||||
#define __SHIFTMASK(a) (__SHIFTBITS(a) - 1)
|
||||
#define CLI_ROL(a, b) a = (a << ((b) & __SHIFTMASK(a))) | (a >> ((__SHIFTBITS(a) - (b)) & __SHIFTMASK(a)))
|
||||
#define CLI_ROR(a, b) a = (a >> ((b) & __SHIFTMASK(a))) | (a << ((__SHIFTBITS(a) - (b)) & __SHIFTMASK(a)))
|
||||
#define CLI_ROL(a, b) a = (a << ((b)&__SHIFTMASK(a))) | (a >> ((__SHIFTBITS(a) - (b)) & __SHIFTMASK(a)))
|
||||
#define CLI_ROR(a, b) a = (a >> ((b)&__SHIFTMASK(a))) | (a << ((__SHIFTBITS(a) - (b)) & __SHIFTMASK(a)))
|
||||
|
||||
/* Implementation independent sign-extended signed right shift */
|
||||
#ifdef HAVE_SAR
|
||||
|
|
|
@ -481,8 +481,8 @@ int pdf_findobj_in_objstm(struct pdf_struct *pdf, struct objstm_struct *objstm,
|
|||
/* Success! Add the object to the list of all objects found. */
|
||||
pdf->nobjs++;
|
||||
CLI_MAX_REALLOC_OR_GOTO_DONE(pdf->objs, sizeof(struct pdf_obj *) * pdf->nobjs,
|
||||
cli_warnmsg("pdf_findobj_in_objstm: out of memory finding objects in stream\n"),
|
||||
status = CL_EMEM);
|
||||
cli_warnmsg("pdf_findobj_in_objstm: out of memory finding objects in stream\n"),
|
||||
status = CL_EMEM);
|
||||
pdf->objs[pdf->nobjs - 1] = obj;
|
||||
|
||||
*obj_found = obj;
|
||||
|
@ -3032,7 +3032,8 @@ static void check_user_password(struct pdf_struct *pdf, int R, const char *O,
|
|||
case 3:
|
||||
case 4: {
|
||||
unsigned char *d;
|
||||
size_t sz = 68 + pdf->fileIDlen + (R >= 4 && !EM ? 4 : 0); d = calloc(1, sz);
|
||||
size_t sz = 68 + pdf->fileIDlen + (R >= 4 && !EM ? 4 : 0);
|
||||
d = calloc(1, sz);
|
||||
|
||||
if (!(d))
|
||||
goto done;
|
||||
|
|
|
@ -268,7 +268,7 @@ static char *pdf_decrypt_string(struct pdf_struct *pdf, struct pdf_obj *obj, con
|
|||
bin_length = *length / 2;
|
||||
|
||||
// Convert the hex string to binary
|
||||
CLI_MAX_CALLOC(decoded_bin, 1, bin_length);
|
||||
CLI_MAX_CALLOC_OR_GOTO_DONE(decoded_bin, 1, bin_length);
|
||||
|
||||
hex2str_ret = cli_hex2str_to(hex, decoded_bin, *length);
|
||||
if (hex2str_ret != 0) {
|
||||
|
|
|
@ -188,7 +188,7 @@ int cli_groupiconscan(struct ICON_ENV *icon_env, uint32_t rva)
|
|||
uint16_t depth;
|
||||
uint32_t sz;
|
||||
uint16_t id;
|
||||
} * dir;
|
||||
} *dir;
|
||||
|
||||
raddr = cli_rawaddr(cli_readint32(grp), peinfo->sections, peinfo->nsections, (unsigned int *)(&err), map->len, peinfo->hdr_size);
|
||||
cli_dbgmsg("cli_scanicon: icon group @%x\n", raddr);
|
||||
|
|
|
@ -2402,7 +2402,7 @@ static int cli_loadcbc(FILE *fs, struct cl_engine *engine, unsigned int *signo,
|
|||
unsigned hook = bc->kind - _BC_START_HOOKS;
|
||||
unsigned cnt = ++engine->hooks_cnt[hook];
|
||||
engine->hooks[hook] = cli_safer_realloc_or_free(engine->hooks[hook],
|
||||
sizeof(*engine->hooks[0]) * cnt);
|
||||
sizeof(*engine->hooks[0]) * cnt);
|
||||
if (!engine->hooks[hook]) {
|
||||
cli_errmsg("Out of memory allocating memory for hook %u", hook);
|
||||
return CL_EMEM;
|
||||
|
|
|
@ -235,8 +235,8 @@ cl_error_t regex_list_match(struct regex_matcher *matcher, char *real_url, const
|
|||
free(buffer);
|
||||
free(bufrev);
|
||||
/* filter says this suffix doesn't match.
|
||||
* The filter has false positives, but no false
|
||||
* negatives */
|
||||
* The filter has false positives, but no false
|
||||
* negatives */
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -775,15 +775,15 @@ static cl_error_t add_pattern_suffix(void *cbdata, const char *suffix, size_t su
|
|||
}
|
||||
|
||||
CLI_MALLOC_OR_GOTO_DONE(regex, sizeof(*regex),
|
||||
cli_errmsg("add_pattern_suffix: Unable to allocate memory for regex\n");
|
||||
ret = CL_EMEM);
|
||||
cli_errmsg("add_pattern_suffix: Unable to allocate memory for regex\n");
|
||||
ret = CL_EMEM);
|
||||
|
||||
if (NULL == iregex->pattern) {
|
||||
regex->pattern = NULL;
|
||||
} else {
|
||||
CLI_SAFER_STRDUP_OR_GOTO_DONE(iregex->pattern, regex->pattern,
|
||||
cli_errmsg("add_pattern_suffix: unable to strdup iregex->pattern");
|
||||
ret = CL_EMEM);
|
||||
cli_errmsg("add_pattern_suffix: unable to strdup iregex->pattern");
|
||||
ret = CL_EMEM);
|
||||
}
|
||||
regex->preg = iregex->preg;
|
||||
regex->nxt = NULL;
|
||||
|
@ -803,9 +803,9 @@ static cl_error_t add_pattern_suffix(void *cbdata, const char *suffix, size_t su
|
|||
size_t n = matcher->suffix_cnt;
|
||||
el = cli_hashtab_insert(&matcher->suffix_hash, suffix, suffix_len, (cli_element_data)n);
|
||||
CLI_MAX_REALLOC_OR_GOTO_DONE(matcher->suffix_regexes,
|
||||
(n + 1) * sizeof(*matcher->suffix_regexes),
|
||||
cli_errmsg("add_pattern_suffix: Unable to reallocate memory for matcher->suffix_regexes\n");
|
||||
ret = CL_EMEM);
|
||||
(n + 1) * sizeof(*matcher->suffix_regexes),
|
||||
cli_errmsg("add_pattern_suffix: Unable to reallocate memory for matcher->suffix_regexes\n");
|
||||
ret = CL_EMEM);
|
||||
matcher->suffix_regexes[n].tail = regex;
|
||||
matcher->suffix_regexes[n].head = regex;
|
||||
if (suffix[0] == '/' && suffix[1] == '\0') {
|
||||
|
@ -870,8 +870,8 @@ static cl_error_t add_static_pattern(struct regex_matcher *matcher, char *patter
|
|||
len = reverse_string(pattern);
|
||||
regex.nxt = NULL;
|
||||
CLI_SAFER_STRDUP_OR_GOTO_DONE(pattern, regex.pattern,
|
||||
cli_errmsg("add_static_pattern: Cannot allocate memory for regex.pattern\n");
|
||||
rc = CL_EMEM);
|
||||
cli_errmsg("add_static_pattern: Cannot allocate memory for regex.pattern\n");
|
||||
rc = CL_EMEM);
|
||||
regex.preg = NULL;
|
||||
rc = add_pattern_suffix(matcher, pattern, len, ®ex);
|
||||
done:
|
||||
|
|
|
@ -193,7 +193,7 @@ static uint8_t *parse_char_class(const uint8_t *pat, size_t patSize, size_t *pos
|
|||
do { \
|
||||
if (((*posPtr) + incVal) >= posMax) { \
|
||||
cli_warnmsg("parse_char_class: Invalid char class\n"); \
|
||||
CLI_FREE_AND_SET_NULL(bitmap); \
|
||||
CLI_FREE_AND_SET_NULL(bitmap); \
|
||||
goto done; \
|
||||
} \
|
||||
(*posPtr)++; \
|
||||
|
@ -208,7 +208,7 @@ static uint8_t *parse_char_class(const uint8_t *pat, size_t patSize, size_t *pos
|
|||
uint8_t *bitmap = NULL;
|
||||
|
||||
CLI_MALLOC_OR_GOTO_DONE(bitmap, 32,
|
||||
cli_errmsg("parse_char_class: Unable to allocate memory for bitmap\n"));
|
||||
cli_errmsg("parse_char_class: Unable to allocate memory for bitmap\n"));
|
||||
|
||||
if (pat[*pos] == '^') {
|
||||
memset(bitmap, 0xFF, 32); /*match chars not in brackets*/
|
||||
|
@ -502,8 +502,8 @@ cl_error_t cli_regex2suffix(const char *pattern, regex_t *preg, suffix_callback
|
|||
}
|
||||
regex.nxt = NULL;
|
||||
CLI_SAFER_STRDUP_OR_GOTO_DONE(pattern, regex.pattern,
|
||||
cli_errmsg("cli_regex2suffix: unable to strdup regex.pattern\n");
|
||||
rc = REG_ESPACE);
|
||||
cli_errmsg("cli_regex2suffix: unable to strdup regex.pattern\n");
|
||||
rc = REG_ESPACE);
|
||||
|
||||
n = parse_regex((const uint8_t *)pattern, strlen(pattern), &last);
|
||||
if (!n) {
|
||||
|
|
|
@ -27,6 +27,6 @@
|
|||
#include <stdio.h>
|
||||
#include "clamav-types.h"
|
||||
|
||||
int sf_base64decode(uint8_t*, size_t, uint8_t*, size_t, size_t*);
|
||||
int sf_base64decode(uint8_t *, size_t, uint8_t *, size_t, size_t *);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -634,8 +634,8 @@ static cl_error_t initPointerList(PointerList *pl)
|
|||
|
||||
freePointerList(pl);
|
||||
CLI_CALLOC_OR_GOTO_DONE(pl->idxs, capacity, sizeof(uint8_t *),
|
||||
cli_errmsg("initPointerList: Can't allocate memory\n");
|
||||
ret = CL_EMEM);
|
||||
cli_errmsg("initPointerList: Can't allocate memory\n");
|
||||
ret = CL_EMEM);
|
||||
|
||||
pl->capacity = capacity;
|
||||
done:
|
||||
|
@ -649,8 +649,8 @@ static cl_error_t insertPointer(PointerList *pl, const uint8_t *pointer)
|
|||
if (pl->cnt == (pl->capacity - 1)) {
|
||||
uint32_t newCapacity = pl->capacity + POINTER_LIST_INCREMENT;
|
||||
CLI_SAFER_REALLOC_OR_GOTO_DONE(pl->idxs, newCapacity * sizeof(uint8_t *),
|
||||
cli_errmsg("insertPointer: Can't allocate memory\n");
|
||||
ret = CL_EMEM);
|
||||
cli_errmsg("insertPointer: Can't allocate memory\n");
|
||||
ret = CL_EMEM);
|
||||
|
||||
pl->capacity = newCapacity;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ typedef struct __attribute__((packed)) {
|
|||
} lb_addr;
|
||||
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint32_t length; //4/14.14.1.1
|
||||
uint32_t length; // 4/14.14.1.1
|
||||
/*30 least significant bits are length in bytes.
|
||||
*
|
||||
* 2 most significant bits are described in figure 4/42
|
||||
|
@ -77,7 +77,7 @@ typedef struct __attribute__((packed)) {
|
|||
* 3 the extent is the next extent of allocation descriptors.
|
||||
* */
|
||||
|
||||
lb_addr extentLocation; //logical block number. (CAN be zero)
|
||||
lb_addr extentLocation; // logical block number. (CAN be zero)
|
||||
|
||||
uint8_t implementationUse[6];
|
||||
|
||||
|
@ -155,8 +155,8 @@ typedef struct __attribute__((packed)) {
|
|||
uint16_t partitionReferenceNumber;
|
||||
} LBAddr;
|
||||
|
||||
//https://www.ecma-international.org/wp-content/uploads/ECMA-167_3rd_edition_june_1997.pdf
|
||||
//section 4/23
|
||||
// https://www.ecma-international.org/wp-content/uploads/ECMA-167_3rd_edition_june_1997.pdf
|
||||
// section 4/23
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint32_t priorRecordedNumberOfDirectEntries;
|
||||
uint16_t strategyType;
|
||||
|
@ -252,7 +252,7 @@ typedef struct __attribute__((packed)) {
|
|||
uint32_t allocationDescLen;
|
||||
|
||||
/* Variable length stuff here, need to handle;
|
||||
*/
|
||||
*/
|
||||
uint8_t rest[1];
|
||||
|
||||
} FileEntryDescriptor;
|
||||
|
@ -284,7 +284,7 @@ typedef struct __attribute__((packed)) {
|
|||
|
||||
uint64_t infoLength;
|
||||
|
||||
uint64_t objectSize; //different
|
||||
uint64_t objectSize; // different
|
||||
|
||||
uint64_t logicalBlocksRecorded;
|
||||
|
||||
|
@ -292,17 +292,17 @@ typedef struct __attribute__((packed)) {
|
|||
|
||||
timestamp modificationDateTime;
|
||||
|
||||
timestamp creationDateTime; //different
|
||||
timestamp creationDateTime; // different
|
||||
|
||||
timestamp attributeDateTime;
|
||||
|
||||
uint32_t checkpoint;
|
||||
|
||||
uint32_t reserved; //different
|
||||
uint32_t reserved; // different
|
||||
|
||||
long_ad extendedAttrICB;
|
||||
|
||||
long_ad streamDirectoryICB; //different
|
||||
long_ad streamDirectoryICB; // different
|
||||
|
||||
regid implementationId;
|
||||
|
||||
|
@ -313,7 +313,7 @@ typedef struct __attribute__((packed)) {
|
|||
uint32_t allocationDescLen;
|
||||
|
||||
/* Variable length stuff here, need to handle;
|
||||
*/
|
||||
*/
|
||||
|
||||
} ExtendedFileEntryDescriptor;
|
||||
|
||||
|
@ -462,7 +462,7 @@ typedef struct __attribute__((packed)) {
|
|||
|
||||
charspec descriptorCharSet;
|
||||
|
||||
uint8_t logicalVolumeIdentifier[128]; //TODO: handle dstring
|
||||
uint8_t logicalVolumeIdentifier[128]; // TODO: handle dstring
|
||||
|
||||
uint32_t logicalBlockSize;
|
||||
|
||||
|
@ -480,7 +480,7 @@ typedef struct __attribute__((packed)) {
|
|||
|
||||
ext_ad integritySequenceExtent;
|
||||
|
||||
uint8_t partitionMaps[1]; //actual length of mapTableLength above;
|
||||
uint8_t partitionMaps[1]; // actual length of mapTableLength above;
|
||||
|
||||
} LogicalVolumeDescriptor;
|
||||
|
||||
|
|
|
@ -470,7 +470,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
ret = CL_EREAD;
|
||||
goto done;
|
||||
}
|
||||
memcpy(&val16, &data[data_offset], sizeof (uint16_t));
|
||||
memcpy(&val16, &data[data_offset], sizeof(uint16_t));
|
||||
id = le16_to_host(val16);
|
||||
data_offset += sizeof(uint16_t);
|
||||
|
||||
|
@ -479,7 +479,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
ret = CL_EREAD;
|
||||
goto done;
|
||||
}
|
||||
memcpy(&val32, &data[data_offset], sizeof (uint32_t));
|
||||
memcpy(&val32, &data[data_offset], sizeof(uint32_t));
|
||||
size = le32_to_host(val32);
|
||||
data_offset += sizeof(uint32_t);
|
||||
|
||||
|
@ -497,7 +497,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
ret = CL_EREAD;
|
||||
goto done;
|
||||
}
|
||||
memcpy(&val32, &data[data_offset], sizeof (uint32_t));
|
||||
memcpy(&val32, &data[data_offset], sizeof(uint32_t));
|
||||
uint32_t sys_kind = le32_to_host(val32);
|
||||
data_offset += sizeof(uint32_t);
|
||||
CLI_WRITEN("REM PROJECTSYSKIND: ", 20);
|
||||
|
@ -534,7 +534,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
ret = CL_EREAD;
|
||||
goto done;
|
||||
}
|
||||
memcpy(&val32, &data[data_offset], sizeof (uint32_t));
|
||||
memcpy(&val32, &data[data_offset], sizeof(uint32_t));
|
||||
uint32_t lcid = le32_to_host(val32);
|
||||
char buf[64];
|
||||
data_offset += size;
|
||||
|
@ -552,7 +552,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
ret = CL_EREAD;
|
||||
goto done;
|
||||
}
|
||||
memcpy(&val32, &data[data_offset], sizeof (uint32_t));
|
||||
memcpy(&val32, &data[data_offset], sizeof(uint32_t));
|
||||
uint32_t lcid_invoke = le32_to_host(val32);
|
||||
char buf[64];
|
||||
data_offset += sizeof(uint32_t);
|
||||
|
@ -570,7 +570,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
ret = CL_EREAD;
|
||||
goto done;
|
||||
}
|
||||
memcpy(&val16, &data[data_offset], sizeof (uint16_t));
|
||||
memcpy(&val16, &data[data_offset], sizeof(uint16_t));
|
||||
codepage = le16_to_host(val16);
|
||||
char buf[64];
|
||||
data_offset += sizeof(uint16_t);
|
||||
|
@ -640,7 +640,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
ret = CL_EREAD;
|
||||
goto done;
|
||||
}
|
||||
memcpy(&val16, &data[data_offset], sizeof (uint16_t));
|
||||
memcpy(&val16, &data[data_offset], sizeof(uint16_t));
|
||||
id = le16_to_host(val16);
|
||||
if (id != 0x003d) {
|
||||
cli_warnmsg("vba_readdir_new: PROJECTHELPFILEPATH is not followed by PROJECTHELPFILEPATH2\n");
|
||||
|
@ -655,7 +655,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
goto done;
|
||||
}
|
||||
uint32_t size2;
|
||||
memcpy(&val32, &data[data_offset], sizeof (uint32_t));
|
||||
memcpy(&val32, &data[data_offset], sizeof(uint32_t));
|
||||
size2 = le32_to_host(val32);
|
||||
data_offset += sizeof(uint32_t);
|
||||
|
||||
|
@ -692,7 +692,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
ret = CL_EREAD;
|
||||
goto done;
|
||||
}
|
||||
memcpy(&val32, &data[data_offset], sizeof (uint32_t));
|
||||
memcpy(&val32, &data[data_offset], sizeof(uint32_t));
|
||||
uint32_t context = le32_to_host(val32);
|
||||
char buf[64];
|
||||
data_offset += size;
|
||||
|
@ -710,7 +710,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
ret = CL_EREAD;
|
||||
goto done;
|
||||
}
|
||||
memcpy(&val32, &data[data_offset], sizeof (uint32_t));
|
||||
memcpy(&val32, &data[data_offset], sizeof(uint32_t));
|
||||
uint32_t libflags = le32_to_host(val32);
|
||||
char buf[64];
|
||||
data_offset += sizeof(uint32_t);
|
||||
|
@ -729,7 +729,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
ret = CL_EREAD;
|
||||
goto done;
|
||||
}
|
||||
memcpy(&val32, &data[data_offset], sizeof (uint32_t));
|
||||
memcpy(&val32, &data[data_offset], sizeof(uint32_t));
|
||||
uint32_t major = le32_to_host(val32);
|
||||
data_offset += size;
|
||||
|
||||
|
@ -738,7 +738,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
ret = CL_EREAD;
|
||||
goto done;
|
||||
}
|
||||
memcpy(&val16, &data[data_offset], sizeof (uint16_t));
|
||||
memcpy(&val16, &data[data_offset], sizeof(uint16_t));
|
||||
uint16_t minor = le16_to_host(val16);
|
||||
data_offset += sizeof(uint16_t);
|
||||
char buf[64];
|
||||
|
@ -756,7 +756,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
ret = CL_EREAD;
|
||||
goto done;
|
||||
}
|
||||
memcpy(&val16, &data[data_offset], sizeof (uint16_t));
|
||||
memcpy(&val16, &data[data_offset], sizeof(uint16_t));
|
||||
uint16_t modules = le16_to_host(val16);
|
||||
data_offset += sizeof(uint16_t);
|
||||
char buf[64];
|
||||
|
@ -774,7 +774,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
ret = CL_EREAD;
|
||||
goto done;
|
||||
}
|
||||
memcpy(&val16, &data[data_offset], sizeof (uint16_t));
|
||||
memcpy(&val16, &data[data_offset], sizeof(uint16_t));
|
||||
uint16_t cookie = le16_to_host(val16);
|
||||
data_offset += sizeof(uint16_t);
|
||||
char buf[64];
|
||||
|
@ -808,7 +808,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
goto done;
|
||||
}
|
||||
|
||||
memcpy(&val16, &data[data_offset], sizeof (uint16_t));
|
||||
memcpy(&val16, &data[data_offset], sizeof(uint16_t));
|
||||
if ((id = le16_to_host(val16)) != 0x0047) {
|
||||
cli_dbgmsg("cli_vba_readdir_new: Expected MODULENAMEUNICODE (0x47) record, but got 0x%04x\n", id);
|
||||
ret = CL_EREAD;
|
||||
|
@ -816,7 +816,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
}
|
||||
data_offset += sizeof(uint16_t);
|
||||
CLI_WRITEN("\nREM MODULENAMEUNICODE: ", 24);
|
||||
memcpy(&val32, &data[data_offset], sizeof (uint32_t));
|
||||
memcpy(&val32, &data[data_offset], sizeof(uint32_t));
|
||||
size = le32_to_host(val32);
|
||||
data_offset += sizeof(uint32_t);
|
||||
|
||||
|
@ -859,7 +859,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
goto done;
|
||||
}
|
||||
|
||||
memcpy(&val16, &data[data_offset], sizeof (uint16_t));
|
||||
memcpy(&val16, &data[data_offset], sizeof(uint16_t));
|
||||
if ((id = le16_to_host(val16)) != 0x001a) {
|
||||
cli_dbgmsg("cli_vba_readdir_new: Expected MODULESTREAMNAME (0x1a) record, but got 0x%04x\n", id);
|
||||
ret = CL_EREAD;
|
||||
|
@ -867,7 +867,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
}
|
||||
data_offset += sizeof(uint16_t);
|
||||
CLI_WRITEN("\nREM MODULESTREAMNAME: ", 23);
|
||||
memcpy(&val32, &data[data_offset], sizeof (uint32_t));
|
||||
memcpy(&val32, &data[data_offset], sizeof(uint32_t));
|
||||
size = le32_to_host(val32);
|
||||
data_offset += sizeof(uint32_t);
|
||||
|
||||
|
@ -894,7 +894,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
goto done;
|
||||
}
|
||||
|
||||
memcpy(&val16, &data[data_offset], sizeof (uint16_t));
|
||||
memcpy(&val16, &data[data_offset], sizeof(uint16_t));
|
||||
if ((id = le16_to_host(val16)) != 0x0032) {
|
||||
cli_dbgmsg("cli_vba_readdir_new: Expected MODULESTREAMNAMEUNICODE (0x32) record, but got 0x%04x\n", id);
|
||||
ret = CL_EREAD;
|
||||
|
@ -902,7 +902,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
}
|
||||
data_offset += sizeof(uint16_t);
|
||||
CLI_WRITEN("\nREM MODULESTREAMNAMEUNICODE: ", 30);
|
||||
memcpy(&val32, &data[data_offset], sizeof (uint32_t));
|
||||
memcpy(&val32, &data[data_offset], sizeof(uint32_t));
|
||||
uint32_t module_stream_name_size = le32_to_host(val32);
|
||||
data_offset += sizeof(uint32_t);
|
||||
|
||||
|
@ -946,7 +946,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
goto done;
|
||||
}
|
||||
|
||||
memcpy(&val16, &data[data_offset], sizeof (uint16_t));
|
||||
memcpy(&val16, &data[data_offset], sizeof(uint16_t));
|
||||
if ((id = le16_to_host(val16)) != 0x001c) {
|
||||
cli_dbgmsg("cli_vba_readdir_new: Expected MODULEDOCSTRING (0x1c) record, but got 0x%04x\n", id);
|
||||
ret = CL_EREAD;
|
||||
|
@ -954,7 +954,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
}
|
||||
data_offset += sizeof(uint16_t);
|
||||
CLI_WRITEN("\nREM MODULEDOCSTRING: ", 22);
|
||||
memcpy(&val32, &data[data_offset], sizeof (uint32_t));
|
||||
memcpy(&val32, &data[data_offset], sizeof(uint32_t));
|
||||
size = le32_to_host(val32);
|
||||
data_offset += sizeof(uint32_t);
|
||||
|
||||
|
@ -981,7 +981,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
goto done;
|
||||
}
|
||||
|
||||
memcpy(&val16, &data[data_offset], sizeof (uint16_t));
|
||||
memcpy(&val16, &data[data_offset], sizeof(uint16_t));
|
||||
if ((id = le16_to_host(val16)) != 0x0048) {
|
||||
cli_dbgmsg("cli_vba_readdir_new: Expected MODULEDOCSTRINGUNICODE (0x32) record, but got 0x%04x\n", id);
|
||||
ret = CL_EREAD;
|
||||
|
@ -989,7 +989,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
}
|
||||
data_offset += sizeof(uint16_t);
|
||||
CLI_WRITEN("\nREM MODULEDOCSTRINGUNICODE: ", 29);
|
||||
memcpy(&val32, &data[data_offset], sizeof (uint32_t));
|
||||
memcpy(&val32, &data[data_offset], sizeof(uint32_t));
|
||||
size = le32_to_host(val32);
|
||||
data_offset += sizeof(uint32_t);
|
||||
|
||||
|
@ -1032,14 +1032,14 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
goto done;
|
||||
}
|
||||
|
||||
memcpy(&val16, &data[data_offset], sizeof (uint16_t));
|
||||
memcpy(&val16, &data[data_offset], sizeof(uint16_t));
|
||||
if ((id = le16_to_host(val16)) != 0x0031) {
|
||||
cli_dbgmsg("cli_vba_readdir_new: Expected MODULEOFFSET (0x31) record, but got 0x%04x\n", id);
|
||||
ret = CL_EREAD;
|
||||
goto done;
|
||||
}
|
||||
data_offset += sizeof(uint16_t);
|
||||
memcpy(&val32, &data[data_offset], sizeof (uint32_t));
|
||||
memcpy(&val32, &data[data_offset], sizeof(uint32_t));
|
||||
size = le32_to_host(val32);
|
||||
data_offset += sizeof(uint32_t);
|
||||
if (size != sizeof(uint32_t)) {
|
||||
|
@ -1054,7 +1054,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
goto done;
|
||||
}
|
||||
|
||||
memcpy(&val32, &data[data_offset], sizeof (uint32_t));
|
||||
memcpy(&val32, &data[data_offset], sizeof(uint32_t));
|
||||
uint32_t module_offset = le32_to_host(val32);
|
||||
data_offset += size;
|
||||
char buffer[64];
|
||||
|
@ -1071,7 +1071,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
goto done;
|
||||
}
|
||||
|
||||
memcpy(&val16, &data[data_offset], sizeof (uint16_t));
|
||||
memcpy(&val16, &data[data_offset], sizeof(uint16_t));
|
||||
if ((id = le16_to_host(val16)) != 0x001e) {
|
||||
cli_dbgmsg("cli_vba_readdir_new: Expected MODULEHELPCONTEXT (0x1e) record, but got 0x%04x\n", id);
|
||||
ret = CL_EREAD;
|
||||
|
@ -1079,7 +1079,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
}
|
||||
|
||||
data_offset += sizeof(uint16_t);
|
||||
memcpy(&val32, &data[data_offset], sizeof (uint32_t));
|
||||
memcpy(&val32, &data[data_offset], sizeof(uint32_t));
|
||||
size = le32_to_host(val32);
|
||||
data_offset += sizeof(uint32_t);
|
||||
if (size != sizeof(uint32_t)) {
|
||||
|
@ -1094,7 +1094,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
goto done;
|
||||
}
|
||||
|
||||
memcpy(&val32, &data[data_offset], sizeof (uint32_t));
|
||||
memcpy(&val32, &data[data_offset], sizeof(uint32_t));
|
||||
uint32_t help_context = le32_to_host(val32);
|
||||
data_offset += size;
|
||||
buffer_size = snprintf(buffer, sizeof(buffer), "\nREM MODULEHELPCONTEXT: 0x%08x", help_context);
|
||||
|
@ -1110,14 +1110,14 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
goto done;
|
||||
}
|
||||
|
||||
memcpy(&val16, &data[data_offset], sizeof (uint16_t));
|
||||
memcpy(&val16, &data[data_offset], sizeof(uint16_t));
|
||||
if ((id = le16_to_host(val16)) != 0x002c) {
|
||||
cli_dbgmsg("cli_vba_readdir_new: Expected MODULECOOKIE (0x2c) record, but got 0x%04x\n", id);
|
||||
ret = CL_EREAD;
|
||||
goto done;
|
||||
}
|
||||
data_offset += sizeof(uint16_t);
|
||||
memcpy(&val32, &data[data_offset], sizeof (uint32_t));
|
||||
memcpy(&val32, &data[data_offset], sizeof(uint32_t));
|
||||
size = le32_to_host(val32);
|
||||
data_offset += sizeof(uint32_t);
|
||||
if (size != sizeof(uint16_t)) {
|
||||
|
@ -1132,7 +1132,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
goto done;
|
||||
}
|
||||
|
||||
memcpy(&val16, &data[data_offset], sizeof (uint16_t));
|
||||
memcpy(&val16, &data[data_offset], sizeof(uint16_t));
|
||||
uint16_t cookie = le16_to_host(val16);
|
||||
data_offset += size;
|
||||
buffer_size = snprintf(buffer, sizeof(buffer), "\nREM MODULECOOKIE: 0x%04x", cookie);
|
||||
|
@ -1147,7 +1147,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
goto done;
|
||||
}
|
||||
|
||||
memcpy(&val16, &data[data_offset], sizeof (uint16_t));
|
||||
memcpy(&val16, &data[data_offset], sizeof(uint16_t));
|
||||
id = le16_to_host(val16);
|
||||
if (id != 0x0021 && id != 0x0022) {
|
||||
cli_dbgmsg("cli_vba_readdir_new: Expected MODULETYPE (0x21/0x22) record, but got 0x%04x\n", id);
|
||||
|
@ -1155,7 +1155,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
goto done;
|
||||
}
|
||||
data_offset += sizeof(uint16_t);
|
||||
memcpy(&val32, &data[data_offset], sizeof (uint32_t));
|
||||
memcpy(&val32, &data[data_offset], sizeof(uint32_t));
|
||||
size = le32_to_host(val32);
|
||||
data_offset += sizeof(uint32_t);
|
||||
if (size != 0) {
|
||||
|
@ -1176,7 +1176,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
goto done;
|
||||
}
|
||||
|
||||
memcpy(&val16, &data[data_offset], sizeof (uint16_t));
|
||||
memcpy(&val16, &data[data_offset], sizeof(uint16_t));
|
||||
id = le16_to_host(val16);
|
||||
data_offset += sizeof(uint16_t);
|
||||
|
||||
|
@ -1187,7 +1187,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
goto done;
|
||||
}
|
||||
|
||||
memcpy(&val32, &data[data_offset], sizeof (uint32_t));
|
||||
memcpy(&val32, &data[data_offset], sizeof(uint32_t));
|
||||
size = le32_to_host(val32);
|
||||
data_offset += sizeof(uint32_t);
|
||||
if (size != 0) {
|
||||
|
@ -1203,7 +1203,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
goto done;
|
||||
}
|
||||
|
||||
memcpy(&val16, &data[data_offset], sizeof (uint16_t));
|
||||
memcpy(&val16, &data[data_offset], sizeof(uint16_t));
|
||||
id = le16_to_host(val16);
|
||||
data_offset += sizeof(uint16_t);
|
||||
}
|
||||
|
@ -1216,7 +1216,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
goto done;
|
||||
}
|
||||
|
||||
memcpy(&val32, &data[data_offset], sizeof (uint32_t));
|
||||
memcpy(&val32, &data[data_offset], sizeof(uint32_t));
|
||||
size = le32_to_host(val32);
|
||||
data_offset += sizeof(uint32_t);
|
||||
if (size != 0) {
|
||||
|
@ -1232,7 +1232,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
goto done;
|
||||
}
|
||||
|
||||
memcpy(&val16, &data[data_offset], sizeof (uint16_t));
|
||||
memcpy(&val16, &data[data_offset], sizeof(uint16_t));
|
||||
id = le16_to_host(val16);
|
||||
data_offset += sizeof(uint16_t);
|
||||
}
|
||||
|
@ -1250,7 +1250,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
|
|||
goto done;
|
||||
}
|
||||
|
||||
memcpy(&val32, &data[data_offset], sizeof (uint32_t));
|
||||
memcpy(&val32, &data[data_offset], sizeof(uint32_t));
|
||||
size = le32_to_host(val32);
|
||||
data_offset += sizeof(uint32_t);
|
||||
if (size != 0) {
|
||||
|
@ -2021,7 +2021,7 @@ word_read_macro_entry(int fd, macro_info_t *macro_info)
|
|||
uint32_t len __attribute__((packed));
|
||||
uint32_t state __attribute__((packed));
|
||||
uint32_t offset __attribute__((packed));
|
||||
} * m;
|
||||
} *m;
|
||||
const struct macro *n;
|
||||
#ifdef HAVE_PRAGMA_PACK
|
||||
#pragma pack()
|
||||
|
|
|
@ -22,11 +22,11 @@
|
|||
#include <errno.h>
|
||||
|
||||
#include <Windows.h>
|
||||
//#include "clamav.h"
|
||||
//#include "others.h"
|
||||
// #include "clamav.h"
|
||||
// #include "others.h"
|
||||
#include "dirent.h"
|
||||
#include "w32_stat.h"
|
||||
//#include "misc.h"
|
||||
// #include "misc.h"
|
||||
|
||||
DIR *opendir(const char *name)
|
||||
{
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#define strncasecmp _strnicmp
|
||||
#ifndef _LIBC
|
||||
//# include <config.h>
|
||||
// # include <config.h>
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
|
@ -31,7 +31,7 @@
|
|||
#endif
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
//#include <stdbool.h>
|
||||
// #include <stdbool.h>
|
||||
|
||||
#ifdef _LIBC
|
||||
#include "../locale/localeinfo.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue