Add check for EOF to prevent infinite loop

Tested on my machine with both a 64-character and 65-character `core.excludesfile` value.