search: protect x[-1] with length check
search: protect x[-1] with length check

Otherwise, "Less than" and "Greater than" symbols in a search query
cause an out-of-range access and a 500 server error.

Reported by Steffen Goertz.

Signed-off-by: Paolo Bonzini <69d3ebcf5ee4e7f05a50dc23cd96655b730804b4@redhat.com>

patchew-project/patchew,patchew-project/patchew,patchew-project/patchew,patchew-project/patchew