From: Todd C. Miller Date: Tue, 6 May 2003 04:31:24 +0000 (+0000) Subject: Fix an off by one error when reallocating the environment; Kevin Pye X-Git-Tag: SUDO_1_6_8~312 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=684f62dd0fa680e928e921c4d777db3b5c5be8c4;p=sudo Fix an off by one error when reallocating the environment; Kevin Pye --- diff --git a/env.c b/env.c index 9687e432c..88f2ffa19 100644 --- a/env.c +++ b/env.c @@ -250,8 +250,8 @@ insert_env(str, dupcheck) char **nep; size_t varlen; - /* Make sure there is room for the new entry. */ - if (env_len + 1 > env_size) { + /* Make sure there is room for the new entry plus a NULL. */ + if (env_len + 2 > env_size) { env_size += 128; new_environ = erealloc3(new_environ, env_size, sizeof(char *)); }