Do not scan past the end of the buffer. If no terminating delimiter is found, just leave things as it is