Refactor: remoted: Clean up load_env_vars()
This makes two Coverity false positives (tainted name and value passed
to setenv()) go away. It also makes the function's logic easier to
follow.
We now use getline() instead of fgets(). Instead of reading into a
fixed-size buffer, getline() allocates a buffer large enough to hold the
line, and it calls realloc() as needed. This is not an execution path
where performance is critical enough for this to matter.
getline() also returns the number of characters read, so that if there
is a '\0' character within a line, the caller can tell that the end of
line has not yet been reached. This doesn't seem to matter for our use
case, since we don't want to allow null bytes inside a name or value.
We also make liberal use of continue statements to avoid nesting where
possible, and this allows us to get rid of the places where we set value
to NULL.
This will be painful to review, so sorry in advance.
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>