Strange thing is I am not getting any errors or warnings when I test this.
These sort of out-of-bound array bugs can be fickle in their impact on testing. It depends on the data that the compiler places after the array (as this is on the stack) and what the program does with that adjacent data afterwards. Usually, out-of-bound
writes are much more problematic, but it is good habit to fix these bugs once found, as a habit of secure coding.
In this particular case, I believe the possibility of an outright crash in testing is low. This is in part why this class of bug is so insidious, and difficult to track down.
The function get_index_sexp_variable_name_special() merely does some checks, and then returns i or -1. However, if the function calling get_index_sexp_variable_name_special() were then to trust the value of i returned is sane (which it might not be should it be set to MAX_SEXP_VARIABLES) then later use of i with Sexp_variables[] could lead to more critical bugs.
The long and the short is that it could lead to operations on Sexp_variables[] actually affecting other memory, and that is a problem.