Fix asan failure due to bug in string search.

Change-Id: I9759109ec2c6c262f5c17393b84dde8dddf851ff
(cherry picked from commit d31cb916637d79c7214d398f3e8d4a8599e74932)
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1972
Reviewed-by: Nong Li <nong@cloudera.com>
Tested-by: Nong Li <nong@cloudera.com>
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1980
Tested-by: jenkins