I'm not sure if there's an issue for this, but the check if beyond end of string should be tested before dereferencing the pointer to the buffer.
|
if (*text == 0 || text >= endptr_) |
e.g. (should check if gone past end first, otherwise check if it points to a null terminator \0 character):
//if (*text == 0 || text >= endptr_)
if (text >= endptr_ || *text == 0)
break;