Current str_replace code will read outside buffer if `isspace` and `from` occurs at the start of `buffer`