Fixed issue with buffer containing non-NULL-terminated string