extra: use get_implied_value() instead of get_value() inside comparisons
[smatch.git] / check_format_string.c
blob5fb37ec5fa24ca34a469ad86198b2f35a81e3305
1 #include <string.h>
2 #include "smatch.h"
3 #include "smatch_extra.h"
5 static int my_id;
7 static void match_printf(const char *fn, struct expression *expr, void *unused)
9 struct expression *format;
11 format = get_argument_from_call_expr(expr->args, 0);
12 if (format -> type != EXPR_STRING)
13 sm_msg("warn: format strings should be constant to avoid format string vulnerabilities");
17 void check_format_string(int id)
19 if (!option_spammy)
20 return;
21 my_id = id;
22 add_function_hook("printf", &match_printf, (void *)0);