Prevent buffer underflow and close string.  Also recognize alternative record separator on Windows. (transplanted from ec76161adec379b6b26c79f91279396cd9db2a53)
Prevent buffer underflow and close string.  Also recognize alternative record separator on Windows.
(transplanted from ec76161adec379b6b26c79f91279396cd9db2a53)

zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb