Print this page
new smatch

*** 67,86 **** } static int match_sprintf(struct expression *call, void *_arg, struct range_list **rl) { int str_arg = PTR_INT(_arg); ! int size; ! size = get_formatted_string_size(call, str_arg); ! if (size <= 0) { *rl = alloc_whole_rl(&ulong_ctype); } else { ! /* FIXME: This is bogus. get_formatted_string_size() should be ! returning a range_list. Also it should not add the NUL. */ ! size--; ! *rl = alloc_rl(ll_to_sval(0), ll_to_sval(size)); } return 1; } void register_common_functions(int id) --- 67,85 ---- } static int match_sprintf(struct expression *call, void *_arg, struct range_list **rl) { int str_arg = PTR_INT(_arg); ! int min, max; ! min = get_formatted_string_min_size(call, str_arg); ! max = get_formatted_string_size(call, str_arg); ! if (min < 0 || max < 0) { *rl = alloc_whole_rl(&ulong_ctype); } else { ! *rl = alloc_rl(ll_to_sval(min), ll_to_sval(max)); ! *rl = cast_rl(get_type(call), *rl); } return 1; } void register_common_functions(int id)