introduce get_fuzzy_max()
For detecting array out of bounds errors we want to know the max value of
the offset. Up to now smatch has been using the implied max, but now
we can use the idea of a fuzzy max as well.
if (x < sizeof(buf))
buf[x] = '\0'; // <-- #1
buf[x] = '\0'; // <-- #2
For the above code at point #1 the implied max is sizeof(buf) - 1. At
point #2 there is no implied max but it seems from the context that x
could at least be == sizeof(buf) so that is our fuzzy max.
The idea came from Xuan Ji.
Reported-by: Li Xuan Ji <xuanji@gmail.com>
Signed-off-by: Dan Carpenter <error27@gmail.com>