lib_sscanf: fixed a hang in scanf() on end of string

if we reach end of buffer when we are not on a format specifier then
the code would loop forever.