]> granicus.if.org Git - sudo/commitdiff
Fix an off by one error when reallocating the environment; Kevin Pye
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 6 May 2003 04:31:24 +0000 (04:31 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 6 May 2003 04:31:24 +0000 (04:31 +0000)
env.c

diff --git a/env.c b/env.c
index 9687e432cf678aab7a6c09ba67198053f8a202f0..88f2ffa192cfb1eac7e50fcea6a8c4631f9cab40 100644 (file)
--- 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 *));
     }