index_overflow: fix false positives when we're memcpy()ing zero bytes
It's pretty common to do:
memcpy(byte_array[idx], src, sizeof(byte_array) - idx);
In this code "idx" can be equal to sizeof(byte_array) but it's not a bug
because in that case we're going to copy zero bytes. Smatch was printing
a warning for this code, and it should not.
My fix is to say that if the array is part of a memcpy and the rl_max() is
the size of the array then don't warn.
I could have written a more fine grained fix for this, which checked for
if the rl_max() == size then is the memcpy() size definitely zero? But
that seemed more complicated than it was worth. There is a separate
memcpy() overflow check where that warning belongs.
Reported-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>