[Template] Avoid reading beyond the end of the buffer in preload scanner when check...