flow: ignore arrays with over a 1000 elements
[smatch.git] / smatch_buf_size.c
bloba7f9e08a81ef70786e43eb49b13dabed05b51ca9
1 /*
2 * Copyright (C) 2010 Dan Carpenter.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see http://www.gnu.org/copyleft/gpl.txt
18 #include <stdlib.h>
19 #include <errno.h>
20 #include "parse.h"
21 #include "smatch.h"
22 #include "smatch_slist.h"
23 #include "smatch_extra.h"
24 #include "smatch_function_hashtable.h"
26 #define UNKNOWN_SIZE (-1)
28 static int my_size_id;
30 struct limiter {
31 int buf_arg;
32 int limit_arg;
34 static struct limiter b0_l2 = {0, 2};
36 static DEFINE_HASHTABLE_INSERT(insert_func, char, int);
37 static DEFINE_HASHTABLE_SEARCH(search_func, char, int);
38 static struct hashtable *allocation_funcs;
40 static char *get_fn_name(struct expression *expr)
42 if (expr->type != EXPR_CALL)
43 return NULL;
44 if (expr->fn->type != EXPR_SYMBOL)
45 return NULL;
46 return expr_to_var(expr->fn);
49 static int is_allocation_function(struct expression *expr)
51 char *func;
52 int ret = 0;
54 func = get_fn_name(expr);
55 if (!func)
56 return 0;
57 if (search_func(allocation_funcs, func))
58 ret = 1;
59 free_string(func);
60 return ret;
63 static void add_allocation_function(const char *func, void *call_back, int param)
65 insert_func(allocation_funcs, (char *)func, (int *)1);
66 add_function_assign_hook(func, call_back, INT_PTR(param));
69 static int estate_to_size(struct smatch_state *state)
71 sval_t sval;
73 if (!state || !estate_rl(state))
74 return 0;
75 sval = estate_max(state);
76 return sval.value;
79 static struct smatch_state *size_to_estate(int size)
81 sval_t sval;
83 sval.type = &int_ctype;
84 sval.value = size;
86 return alloc_estate_sval(sval);
89 static struct range_list *size_to_rl(int size)
91 sval_t sval;
93 sval.type = &int_ctype;
94 sval.value = size;
96 return alloc_rl(sval, sval);
99 static struct smatch_state *unmatched_size_state(struct sm_state *sm)
101 return size_to_estate(UNKNOWN_SIZE);
104 static void set_size_undefined(struct sm_state *sm, struct expression *mod_expr)
106 set_state(sm->owner, sm->name, sm->sym, size_to_estate(UNKNOWN_SIZE));
109 static struct smatch_state *merge_size_func(struct smatch_state *s1, struct smatch_state *s2)
111 return merge_estates(s1, s2);
114 void set_param_buf_size(const char *name, struct symbol *sym, char *key, char *value)
116 struct range_list *rl = NULL;
117 struct smatch_state *state;
118 char fullname[256];
120 if (strncmp(key, "$", 1) != 0)
121 return;
123 snprintf(fullname, 256, "%s%s", name, key + 1);
125 str_to_rl(&int_ctype, value, &rl);
126 if (!rl || is_whole_rl(rl))
127 return;
128 state = alloc_estate_rl(rl);
129 set_state(my_size_id, fullname, sym, state);
132 static int bytes_per_element(struct expression *expr)
134 struct symbol *type;
136 if (!expr)
137 return 0;
138 if (expr->type == EXPR_STRING)
139 return 1;
140 type = get_type(expr);
141 if (!type)
142 return 0;
144 if (type->type != SYM_PTR && type->type != SYM_ARRAY)
145 return 0;
147 type = get_base_type(type);
148 return type_bytes(type);
151 static int bytes_to_elements(struct expression *expr, int bytes)
153 int bpe;
155 bpe = bytes_per_element(expr);
156 if (bpe == 0)
157 return 0;
158 return bytes / bpe;
161 static int elements_to_bytes(struct expression *expr, int elements)
163 int bpe;
165 bpe = bytes_per_element(expr);
166 return elements * bpe;
169 static int get_initializer_size(struct expression *expr)
171 switch (expr->type) {
172 case EXPR_STRING:
173 return expr->string->length;
174 case EXPR_INITIALIZER: {
175 struct expression *tmp;
176 int i = 0;
178 FOR_EACH_PTR(expr->expr_list, tmp) {
179 if (tmp->type == EXPR_INDEX) {
180 if (tmp->idx_to >= i)
181 i = tmp->idx_to;
182 else
183 continue;
186 i++;
187 } END_FOR_EACH_PTR(tmp);
188 return i;
190 case EXPR_SYMBOL:
191 return get_array_size(expr);
193 return 0;
196 static struct range_list *db_size_rl;
197 static int db_size_callback(void *unused, int argc, char **argv, char **azColName)
199 struct range_list *tmp = NULL;
201 if (!db_size_rl) {
202 str_to_rl(&int_ctype, argv[0], &db_size_rl);
203 } else {
204 str_to_rl(&int_ctype, argv[0], &tmp);
205 db_size_rl = rl_union(db_size_rl, tmp);
207 return 0;
210 static struct range_list *size_from_db(struct expression *expr)
212 int this_file_only = 0;
213 char *name;
215 name = get_member_name(expr);
216 if (!name && is_static(expr)) {
217 name = expr_to_var(expr);
218 this_file_only = 1;
220 if (!name)
221 return 0;
223 if (this_file_only) {
224 db_size_rl = NULL;
225 run_sql(db_size_callback, NULL,
226 "select size from function_type_size where type = '%s' and file = '%s';",
227 name, get_filename());
228 if (db_size_rl)
229 return db_size_rl;
230 return 0;
233 db_size_rl = NULL;
234 run_sql(db_size_callback, NULL,
235 "select size from type_size where type = '%s';",
236 name);
237 return db_size_rl;
240 static void db_returns_buf_size(struct expression *expr, int param, char *unused, char *math)
242 struct expression *call;
243 sval_t sval;
245 if (expr->type != EXPR_ASSIGNMENT)
246 return;
247 call = strip_expr(expr->right);
249 if (!parse_call_math(call, math, &sval))
250 return;
251 set_state_expr(my_size_id, expr->left, size_to_estate(sval.value));
254 int get_real_array_size(struct expression *expr)
256 struct symbol *type;
257 sval_t sval;
259 if (!expr)
260 return 0;
261 if (expr->type == EXPR_BINOP) /* array elements foo[5] */
262 return 0;
264 type = get_type(expr);
265 if (!type)
266 return 0;
267 if (!type || type->type != SYM_ARRAY)
268 return 0;
270 if (!get_implied_value(type->array_size, &sval))
271 return 0;
273 /* People put one element arrays on the end of structs */
274 if (sval.value == 1)
275 return 0;
277 return sval.value;
280 static int get_size_from_initializer(struct expression *expr)
282 if (expr->type != EXPR_SYMBOL || !expr->symbol || !expr->symbol->initializer)
283 return 0;
284 if (expr->symbol->initializer == expr) /* int a = a; */
285 return 0;
286 return get_initializer_size(expr->symbol->initializer);
289 static struct range_list *get_stored_size_bytes(struct expression *expr)
291 struct smatch_state *state;
293 state = get_state_expr(my_size_id, expr);
294 if (!state)
295 return NULL;
296 return estate_rl(state);
299 static int get_bytes_from_address(struct expression *expr)
301 struct symbol *type;
302 int ret;
304 if (!option_spammy)
305 return 0;
306 if (expr->type != EXPR_PREOP || expr->op != '&')
307 return 0;
308 type = get_type(expr);
309 if (!type)
310 return 0;
312 if (type->type == SYM_PTR)
313 type = get_base_type(type);
315 ret = type_bytes(type);
316 if (ret == 1)
317 return 0; /* ignore char pointers */
319 return ret;
322 static struct expression *remove_addr_fluff(struct expression *expr)
324 struct expression *tmp;
325 sval_t sval;
327 expr = strip_expr(expr);
329 /* remove '&' and '*' operations that cancel */
330 while (expr && expr->type == EXPR_PREOP && expr->op == '&') {
331 tmp = strip_expr(expr->unop);
332 if (tmp->type != EXPR_PREOP)
333 break;
334 if (tmp->op != '*')
335 break;
336 expr = strip_expr(tmp->unop);
339 if (!expr)
340 return NULL;
342 /* "foo + 0" is just "foo" */
343 if (expr->type == EXPR_BINOP && expr->op == '+' &&
344 get_value(expr->right, &sval) && sval.value == 0)
345 return expr->left;
347 return expr;
350 static int is_last_member_of_struct(struct symbol *sym, struct ident *member)
352 struct symbol *tmp;
353 int i;
355 i = 0;
356 FOR_EACH_PTR_REVERSE(sym->symbol_list, tmp) {
357 if (i++ || !tmp->ident)
358 return 0;
359 if (tmp->ident == member)
360 return 1;
361 return 0;
362 } END_FOR_EACH_PTR_REVERSE(tmp);
364 return 0;
367 static int last_member_is_resizable(struct symbol *sym)
369 struct symbol *last_member;
370 struct symbol *type;
371 sval_t sval;
373 last_member = last_ptr_list((struct ptr_list *)sym->symbol_list);
374 if (!last_member || !last_member->ident)
375 return 0;
377 type = get_real_base_type(last_member);
378 if (type->type == SYM_STRUCT)
379 return last_member_is_resizable(type);
380 if (type->type != SYM_ARRAY)
381 return 0;
383 if (!get_implied_value(type->array_size, &sval))
384 return 0;
386 if (sval.value != 0 && sval.value != 1)
387 return 0;
389 return 1;
392 static int get_stored_size_end_struct_bytes(struct expression *expr)
394 struct symbol *sym;
395 struct symbol *base_sym;
396 struct smatch_state *state;
398 if (expr->type == EXPR_BINOP) /* array elements foo[5] */
399 return 0;
401 if (expr->type == EXPR_PREOP && expr->op == '&')
402 expr = strip_parens(expr->unop);
404 sym = expr_to_sym(expr);
405 if (!sym || !sym->ident)
406 return 0;
407 if (!type_bytes(sym))
408 return 0;
409 if (sym->type != SYM_NODE)
410 return 0;
412 base_sym = get_real_base_type(sym);
413 if (!base_sym || base_sym->type != SYM_PTR)
414 return 0;
415 base_sym = get_real_base_type(base_sym);
416 if (!base_sym || base_sym->type != SYM_STRUCT)
417 return 0;
419 if (!is_last_member_of_struct(base_sym, expr->member))
420 return 0;
421 if (!last_member_is_resizable(base_sym))
422 return 0;
424 state = get_state(my_size_id, sym->ident->name, sym);
425 if (!estate_to_size(state))
426 return 0;
428 return estate_to_size(state) - type_bytes(base_sym) + type_bytes(get_type(expr));
431 static struct range_list *alloc_int_rl(int value)
433 sval_t sval = {
434 .type = &int_ctype,
435 {.value = value},
438 return alloc_rl(sval, sval);
441 struct range_list *get_array_size_bytes_rl(struct expression *expr)
443 int declared_size = 0;
444 struct range_list *ret = NULL;
445 int size;
447 expr = remove_addr_fluff(expr);
448 if (!expr)
449 return NULL;
451 /* "BAR" */
452 if (expr->type == EXPR_STRING)
453 return alloc_int_rl(expr->string->length);
455 if (expr->type == EXPR_BINOP && expr->op == '+') {
456 sval_t offset;
458 if (!get_implied_value(expr->right, &offset))
459 return NULL;
460 size = get_array_size_bytes(expr->left);
461 if (size <= 0)
462 return NULL;
463 return alloc_int_rl(size - offset.value);
466 /* buf[4] */
467 size = get_real_array_size(expr);
468 if (size)
469 declared_size = elements_to_bytes(expr, size);
471 /* buf = malloc(1024); */
472 ret = get_stored_size_bytes(expr);
473 if (ret) {
474 if (declared_size)
475 return rl_union(ret, alloc_int_rl(size));
476 return ret;
478 if (declared_size)
479 return alloc_int_rl(declared_size);
481 size = get_stored_size_end_struct_bytes(expr);
482 if (size)
483 return alloc_int_rl(size);
485 /* char *foo = "BAR" */
486 size = get_size_from_initializer(expr);
487 if (size)
488 return alloc_int_rl(elements_to_bytes(expr, size));
490 size = get_bytes_from_address(expr);
491 if (size)
492 return alloc_int_rl(size);
494 /* if (strlen(foo) > 4) */
495 size = get_size_from_strlen(expr);
496 if (size)
497 return alloc_int_rl(size);
499 ret = size_from_db(expr);
500 if (ret)
501 return ret;
503 return NULL;
506 int get_array_size_bytes(struct expression *expr)
508 struct range_list *rl;
509 sval_t sval;
511 rl = get_array_size_bytes_rl(expr);
512 if (!rl_to_sval(rl, &sval))
513 return 0;
514 if (sval.uvalue >= INT_MAX)
515 return 0;
516 return sval.value;
519 int get_array_size_bytes_max(struct expression *expr)
521 struct range_list *rl;
522 sval_t bytes;
524 rl = get_array_size_bytes_rl(expr);
525 if (!rl)
526 return 0;
527 bytes = rl_min(rl);
528 if (bytes.value < 0)
529 return 0;
530 bytes = rl_max(rl);
531 if (bytes.uvalue >= INT_MAX)
532 return 0;
533 return bytes.value;
536 int get_array_size_bytes_min(struct expression *expr)
538 struct range_list *rl;
539 struct data_range *range;
541 rl = get_array_size_bytes_rl(expr);
542 if (!rl)
543 return 0;
545 FOR_EACH_PTR(rl, range) {
546 if (range->min.value <= 0)
547 return 0;
548 if (range->max.value <= 0)
549 return 0;
550 if (range->min.uvalue >= INT_MAX)
551 return 0;
552 return range->min.value;
553 } END_FOR_EACH_PTR(range);
555 return 0;
558 int get_array_size(struct expression *expr)
560 if (!expr)
561 return 0;
562 return bytes_to_elements(expr, get_array_size_bytes_max(expr));
565 static void match_strlen_condition(struct expression *expr)
567 struct expression *left;
568 struct expression *right;
569 struct expression *str = NULL;
570 int strlen_left = 0;
571 int strlen_right = 0;
572 sval_t sval;
573 struct smatch_state *true_state = NULL;
574 struct smatch_state *false_state = NULL;
576 if (expr->type != EXPR_COMPARE)
577 return;
578 left = strip_expr(expr->left);
579 right = strip_expr(expr->right);
581 if (left->type == EXPR_CALL && sym_name_is("strlen", left->fn)) {
582 str = get_argument_from_call_expr(left->args, 0);
583 strlen_left = 1;
585 if (right->type == EXPR_CALL && sym_name_is("strlen", right->fn)) {
586 str = get_argument_from_call_expr(right->args, 0);
587 strlen_right = 1;
590 if (!strlen_left && !strlen_right)
591 return;
592 if (strlen_left && strlen_right)
593 return;
595 if (strlen_left) {
596 if (!get_value(right, &sval))
597 return;
599 if (strlen_right) {
600 if (!get_value(left, &sval))
601 return;
604 /* FIXME: why are we using my_size_id here instead of my_strlen_id */
606 if (expr->op == SPECIAL_EQUAL) {
607 set_true_false_states_expr(my_size_id, str, size_to_estate(sval.value + 1), NULL);
608 return;
610 if (expr->op == SPECIAL_NOTEQUAL) {
611 set_true_false_states_expr(my_size_id, str, NULL, size_to_estate(sval.value + 1));
612 return;
615 switch (expr->op) {
616 case '<':
617 case SPECIAL_UNSIGNED_LT:
618 if (strlen_left)
619 true_state = size_to_estate(sval.value);
620 else
621 false_state = size_to_estate(sval.value + 1);
622 break;
623 case SPECIAL_LTE:
624 case SPECIAL_UNSIGNED_LTE:
625 if (strlen_left)
626 true_state = size_to_estate(sval.value + 1);
627 else
628 false_state = size_to_estate(sval.value);
629 break;
630 case SPECIAL_GTE:
631 case SPECIAL_UNSIGNED_GTE:
632 if (strlen_left)
633 false_state = size_to_estate(sval.value);
634 else
635 true_state = size_to_estate(sval.value + 1);
636 break;
637 case '>':
638 case SPECIAL_UNSIGNED_GT:
639 if (strlen_left) {
640 true_state = size_to_estate(-1);
641 false_state = size_to_estate(sval.value + 1);
642 } else
643 true_state = size_to_estate(sval.value);
644 break;
646 set_true_false_states_expr(my_size_id, str, true_state, false_state);
649 static struct expression *strip_ampersands(struct expression *expr)
651 struct symbol *type;
653 if (expr->type != EXPR_PREOP)
654 return expr;
655 if (expr->op != '&')
656 return expr;
657 type = get_type(expr->unop);
658 if (!type || type->type != SYM_ARRAY)
659 return expr;
660 return expr->unop;
663 static void info_record_alloction(struct expression *buffer, struct range_list *rl)
665 char *name;
667 if (!option_info)
668 return;
670 name = get_member_name(buffer);
671 if (!name && is_static(buffer))
672 name = expr_to_var(buffer);
673 if (!name)
674 return;
675 if (rl && !is_whole_rl(rl))
676 sql_insert_function_type_size(name, show_rl(rl));
677 else
678 sql_insert_function_type_size(name, "(-1)");
680 free_string(name);
683 static void store_alloc(struct expression *expr, struct range_list *rl)
685 rl = clone_rl(rl); // FIXME!!!
686 info_record_alloction(expr, rl);
687 set_state_expr(my_size_id, expr, alloc_estate_rl(rl));
690 static void match_array_assignment(struct expression *expr)
692 struct expression *left;
693 struct expression *right;
694 char *left_member, *right_member;
695 struct range_list *rl;
696 sval_t sval;
698 if (expr->op != '=')
699 return;
700 left = strip_expr(expr->left);
701 right = strip_expr(expr->right);
702 right = strip_ampersands(right);
704 if (!is_pointer(left))
705 return;
706 if (is_allocation_function(right))
707 return;
709 left_member = get_member_name(left);
710 right_member = get_member_name(right);
711 if (left_member && right_member && strcmp(left_member, right_member) == 0) {
712 free_string(left_member);
713 free_string(right_member);
714 return;
716 free_string(left_member);
717 free_string(right_member);
719 if (get_implied_value(right, &sval) && sval.value == 0) {
720 rl = alloc_int_rl(0);
721 goto store;
724 rl = get_array_size_bytes_rl(right);
726 store:
727 store_alloc(left, rl);
730 static void match_alloc(const char *fn, struct expression *expr, void *_size_arg)
732 int size_arg = PTR_INT(_size_arg);
733 struct expression *right;
734 struct expression *arg;
735 struct range_list *rl;
737 right = strip_expr(expr->right);
738 arg = get_argument_from_call_expr(right->args, size_arg);
739 get_absolute_rl(arg, &rl);
740 rl = cast_rl(&int_ctype, rl);
741 store_alloc(expr->left, rl);
744 static void match_calloc(const char *fn, struct expression *expr, void *unused)
746 struct expression *right;
747 struct expression *arg;
748 sval_t elements;
749 sval_t size;
751 right = strip_expr(expr->right);
752 arg = get_argument_from_call_expr(right->args, 0);
753 if (!get_implied_value(arg, &elements))
754 return; // FIXME!!!
755 arg = get_argument_from_call_expr(right->args, 1);
756 if (get_implied_value(arg, &size))
757 store_alloc(expr->left, size_to_rl(elements.value * size.value));
758 else
759 store_alloc(expr->left, size_to_rl(-1));
762 static void match_limited(const char *fn, struct expression *expr, void *_limiter)
764 struct limiter *limiter = (struct limiter *)_limiter;
765 struct expression *dest;
766 struct expression *size_expr;
767 sval_t size;
769 dest = get_argument_from_call_expr(expr->args, limiter->buf_arg);
770 size_expr = get_argument_from_call_expr(expr->args, limiter->limit_arg);
771 if (!get_implied_max(size_expr, &size))
772 return;
773 set_state_expr(my_size_id, dest, size_to_estate(size.value));
776 static void match_strcpy(const char *fn, struct expression *expr, void *unused)
778 struct expression fake_assign;
780 fake_assign.op = '=';
781 fake_assign.left = get_argument_from_call_expr(expr->args, 0);
782 fake_assign.right = get_argument_from_call_expr(expr->args, 1);
783 match_array_assignment(&fake_assign);
786 static void match_strndup(const char *fn, struct expression *expr, void *unused)
788 struct expression *fn_expr;
789 struct expression *size_expr;
790 sval_t size;
792 fn_expr = strip_expr(expr->right);
793 size_expr = get_argument_from_call_expr(fn_expr->args, 1);
794 if (get_implied_max(size_expr, &size)) {
795 size.value++;
796 store_alloc(expr->left, size_to_rl(size.value));
797 } else {
798 store_alloc(expr->left, size_to_rl(-1));
803 static void match_call(struct expression *expr)
805 struct expression *arg;
806 struct symbol *type;
807 struct range_list *rl;
808 int i;
810 i = -1;
811 FOR_EACH_PTR(expr->args, arg) {
812 i++;
813 type = get_type(arg);
814 if (!type || (type->type != SYM_PTR && type->type != SYM_ARRAY))
815 continue;
816 rl = get_array_size_bytes_rl(arg);
817 if (!rl)
818 continue;
819 if (is_whole_rl(rl))
820 continue;
821 sql_insert_caller_info(expr, BUF_SIZE, i, "$", show_rl(rl));
822 } END_FOR_EACH_PTR(arg);
825 static void struct_member_callback(struct expression *call, int param, char *printed_name, struct sm_state *sm)
827 if (sm->state == &merged ||
828 strcmp(sm->state->name, "(-1)") == 0 ||
829 strcmp(sm->state->name, "empty") == 0 ||
830 strcmp(sm->state->name, "0") == 0)
831 return;
832 sql_insert_caller_info(call, BUF_SIZE, param, printed_name, sm->state->name);
835 void register_buf_size(int id)
837 my_size_id = id;
839 add_unmatched_state_hook(my_size_id, &unmatched_size_state);
841 select_caller_info_hook(set_param_buf_size, BUF_SIZE);
842 select_return_states_hook(BUF_SIZE, &db_returns_buf_size);
844 allocation_funcs = create_function_hashtable(100);
845 add_allocation_function("malloc", &match_alloc, 0);
846 add_allocation_function("calloc", &match_calloc, 0);
847 add_allocation_function("memdup", &match_alloc, 1);
848 add_allocation_function("realloc", &match_alloc, 1);
849 if (option_project == PROJ_KERNEL) {
850 add_allocation_function("kmalloc", &match_alloc, 0);
851 add_allocation_function("kzalloc", &match_alloc, 0);
852 add_allocation_function("vmalloc", &match_alloc, 0);
853 add_allocation_function("__vmalloc", &match_alloc, 0);
854 add_allocation_function("kcalloc", &match_calloc, 0);
855 add_allocation_function("kmalloc_array", &match_calloc, 0);
856 add_allocation_function("drm_malloc_ab", &match_calloc, 0);
857 add_allocation_function("drm_calloc_large", &match_calloc, 0);
858 add_allocation_function("sock_kmalloc", &match_alloc, 1);
859 add_allocation_function("kmemdup", &match_alloc, 1);
860 add_allocation_function("kmemdup_user", &match_alloc, 1);
861 add_allocation_function("dma_alloc_attrs", &match_alloc, 1);
862 add_allocation_function("pci_alloc_consistent", &match_alloc, 1);
863 add_allocation_function("pci_alloc_coherent", &match_alloc, 1);
864 add_allocation_function("devm_kmalloc", &match_alloc, 1);
865 add_allocation_function("devm_kzalloc", &match_alloc, 1);
866 add_allocation_function("krealloc", &match_alloc, 1);
868 add_hook(&match_strlen_condition, CONDITION_HOOK);
870 add_allocation_function("strndup", match_strndup, 0);
871 if (option_project == PROJ_KERNEL)
872 add_allocation_function("kstrndup", match_strndup, 0);
874 add_modification_hook(my_size_id, &set_size_undefined);
876 add_merge_hook(my_size_id, &merge_size_func);
879 void register_buf_size_late(int id)
881 /* has to happen after match_alloc() */
882 add_hook(&match_array_assignment, ASSIGNMENT_HOOK);
884 add_function_hook("strlcpy", &match_limited, &b0_l2);
885 add_function_hook("strlcat", &match_limited, &b0_l2);
886 add_function_hook("memscan", &match_limited, &b0_l2);
888 add_function_hook("strcpy", &match_strcpy, NULL);
890 add_hook(&match_call, FUNCTION_CALL_HOOK);
891 add_member_info_callback(my_size_id, struct_member_callback);