Coverity 1038113: possibly out of bounds read
Coverity 1038518: fix wrong error check
Coverity 1038111: fix local overrun of a string in app layer proto detect setup code.