Null-terminate the lines in arg_env to ensure environment variable value...

...s containing embedded newlines round-trip correctly. Resolves #1018.