diff --git a/ChangeLog b/ChangeLog index 42b70eb33..5161718eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Dec 28 13:53:33 EET 2007 (edwin) +------------------------------------ + * libclamav/phishcheck.h, regex_list.[ch], rtf.c: + avoid holes in data-structures due to alignment. + Thu Dec 27 14:21:52 GMT 2007 (trog) ----------------------------------- * libclamav/chmunpack.c: fix bb#740 diff --git a/libclamav/phishcheck.h b/libclamav/phishcheck.h index e8e2b75be..a07c9e73a 100644 --- a/libclamav/phishcheck.h +++ b/libclamav/phishcheck.h @@ -36,9 +36,9 @@ enum phish_status {CL_PHISH_NODECISION=0, CL_PHISH_CLEAN=CL_PHISH_BASE, #define CL_PHISH_ALL_CHECKS (CLEANUP_URL|CHECK_SSL|CHECK_CLOAKING|CHECK_IMG_URL) struct string { - int refcount; struct string* ref; char* data; + int refcount; }; struct phishcheck { diff --git a/libclamav/regex_list.c b/libclamav/regex_list.c index 888bab11f..2f5e7f910 100644 --- a/libclamav/regex_list.c +++ b/libclamav/regex_list.c @@ -77,15 +77,15 @@ typedef unsigned char* char_bitmap_p; */ struct tree_node { struct tree_node* next;/* next regex/complex sibling, or parent, if no more siblings , can't be NULL except for root node*/ - unsigned char c; - enum token_op_t op; - char alternatives;/* number of (non-regex) children of node, i.e. sizeof(children)*/ - char listend;/* no more siblings, next pointer is pointer to parent*/ union { struct tree_node** children;/* alternatives nr. of children, followed by (a null pointer terminated) regex leaf node pointers) */ char_bitmap_p* bitmap; struct leaf_info* leaf; } u; + enum token_op_t op; + unsigned char c; + char alternatives;/* number of (non-regex) children of node, i.e. sizeof(children)*/ + char listend;/* no more siblings, next pointer is pointer to parent*/ }; struct leaf_info { diff --git a/libclamav/regex_list.h b/libclamav/regex_list.h index 4d2f008a1..47f9f914c 100644 --- a/libclamav/regex_list.h +++ b/libclamav/regex_list.h @@ -45,12 +45,12 @@ struct regex_matcher { struct cli_matcher* root_hosts; struct tree_node* root_regex; struct tree_node* root_regex_hostonly; + struct node_stack node_stack; + struct node_stack node_stack_alt; size_t root_hosts_cnt; int list_inited; int list_loaded; int list_built; - struct node_stack node_stack; - struct node_stack node_stack_alt; }; int regex_list_match(struct regex_matcher* matcher, char* real_url,const char* display_url,const struct pre_fixup_info* pre_fixup, int hostOnly,const char** info,int is_whitelist); diff --git a/libclamav/rtf.c b/libclamav/rtf.c index 61d97f2f8..1c41a4e97 100644 --- a/libclamav/rtf.c +++ b/libclamav/rtf.c @@ -50,6 +50,10 @@ typedef int (*rtf_callback_process)(struct rtf_state*, const unsigned char* data typedef int (*rtf_callback_end)(struct rtf_state*, cli_ctx*); struct rtf_state { + rtf_callback_begin cb_begin;/* must be non-null if you want cb_process, and cb_end to be called, also it must change cb_data to non-null */ + rtf_callback_process cb_process; + rtf_callback_end cb_end; + void* cb_data;/* data set up by cb_begin, used by cb_process, and cleaned up by cb_end. typically state data */ size_t default_elements; size_t controlword_cnt; ssize_t controlword_param; @@ -57,14 +61,10 @@ struct rtf_state { int controlword_param_sign; int encounteredTopLevel;/* encountered top-level control words that we care about */ char controlword[33]; - rtf_callback_begin cb_begin;/* must be non-null if you want cb_process, and cb_end to be called, also it must change cb_data to non-null */ - rtf_callback_process cb_process; - rtf_callback_end cb_end; - void* cb_data;/* data set up by cb_begin, used by cb_process, and cleaned up by cb_end. typically state data */ }; static const struct rtf_state base_state = { - 0,0,0,PARSE_MAIN,0,0," ",NULL,NULL,NULL,NULL + NULL,NULL,NULL,NULL,0,0,0,PARSE_MAIN,0,0," " }; struct stack {