From 48ed7c0a0501facec2d901eef57dc052bfefda30 Mon Sep 17 00:00:00 2001 From: aronpaulson Date: Sun, 18 Oct 2020 17:48:44 +0000 Subject: [PATCH] term: envcpy(...) does not copy environ since memcmp() signals succes by returning 0 which means 'false' in C (and incrementing a local variable at the end of a block has probably no effect) --- term.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/term.c b/term.c index 31048d5..3b36f23 100644 --- a/term.c +++ b/term.c @@ -329,11 +329,11 @@ static void envcpy(char **d, char **s) int i = 0, j = 0; while (s[i] && j < MAXENV - 2) { d[j] = s[i++]; - if (!memcmp(d[j], "TERM=", 5)) + if (memcmp(d[j], "TERM=", 5)) j++; } d[j++] = "TERM=" TERM; - d[j++] = NULL; + d[j] = NULL; } extern char **environ;