segment: Fix read past end of buffer when input ends in '-'.