Correct detection of end of parsed config file

could crash in some builds referencing uninitialized memory