I am a Cppcheck developer. Cppcheck should easily detect that. What Cppcheck version did you use? Latest Cppcheck version is 1.64.
Here is the expected output when cppcheck-1.64 is used:
danielm@HP-Z220-2CMT:~/cppcheck$ ./cppcheck a.c
Checking a.c...
[a.c:5]: (error) Buffer is accessed out of bounds.