1
0
mirror of https://github.com/tmate-io/tmate-ssh-server.git synced 2020-11-18 19:53:51 -08:00

Clear the environment properly by looping until it is empty rather than

looping over it (which may skip entries), from Brad King.
This commit is contained in:
nicm 2016-01-15 11:33:41 +00:00
parent 68d797587e
commit d551ab8e5c

View File

@ -196,10 +196,10 @@ void
environ_push(struct environ *env) environ_push(struct environ *env)
{ {
struct environ_entry *envent; struct environ_entry *envent;
char **vp, *v; char *v;
for (vp = environ; *vp != NULL; vp++) { while (*environ != NULL) {
v = xstrdup(*vp); v = xstrdup(*environ);
v[strcspn(v, "=")] = '\0'; v[strcspn(v, "=")] = '\0';
unsetenv(v); unsetenv(v);