]> granicus.if.org Git - neomutt/commitdiff
Thomas Guettler <thomas@thomas-guettler.de> reports a segfault when
authorThomas Roessler <roessler@does-not-exist.org>
Sat, 8 Sep 2001 14:23:05 +0000 (14:23 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Sat, 8 Sep 2001 14:23:05 +0000 (14:23 +0000)
you search for "~b \\${".

init.c

diff --git a/init.c b/init.c
index 0540b107c7d8c9bcfc1679e122f94c86f4bcf49d..8f57ff5e93abe16d395d3347f9dfeee2701184ff 100644 (file)
--- a/init.c
+++ b/init.c
@@ -244,7 +244,7 @@ int mutt_extract_token (BUFFER *dest, BUFFER *tok, int flags)
     }
     else if (ch == '$' && (!qc || qc == '"') && (*tok->dptr == '{' || isalpha ((unsigned char) *tok->dptr)))
     {
-      char *env, *var;
+      char *env = NULL, *var = NULL;
 
       if (*tok->dptr == '{')
       {
@@ -262,7 +262,7 @@ int mutt_extract_token (BUFFER *dest, BUFFER *tok, int flags)
        var = mutt_substrdup (tok->dptr, pc);
        tok->dptr = pc;
       }
-      if ((env = getenv (var)))
+      if (var && (env = getenv (var)))
        mutt_buffer_addstr (dest, env);
       FREE (&var);
     }