Set end pointers for SC parse
Extract input string assignment to separate function
Safer conditions to detect buffer end