Fix get_value() for ((unsigned int) -1)
[smatch.git] / check_format_string.c
blob4d2e5ef1b0b23a55d2f43d1603beabd1ceb3c3d4
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 my_id = id;
20 add_function_hook("printf", &match_printf, (void *)0);