guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] branch main updated: Fix null dereference in readline in


From: Daniel Llorens
Subject: [Guile-commits] branch main updated: Fix null dereference in readline initialization
Date: Thu, 27 May 2021 06:06:05 -0400

This is an automated email from the git hooks/post-receive script.

lloda pushed a commit to branch main
in repository guile.

The following commit(s) were added to refs/heads/main by this push:
     new c1fd55d  Fix null dereference in readline initialization
c1fd55d is described below

commit c1fd55d1747880ff2ea822e88a1c41482181cb49
Author: Daniel Llorens <lloda@sarc.name>
AuthorDate: Thu May 27 11:56:24 2021 +0200

    Fix null dereference in readline initialization
    
    * guile-readline/readline.c (init_bouncing_parens): Check that the keymap is
      valid before using it.
---
 guile-readline/readline.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/guile-readline/readline.c b/guile-readline/readline.c
index 469d6ec..408ca55 100644
--- a/guile-readline/readline.c
+++ b/guile-readline/readline.c
@@ -431,12 +431,17 @@ static void init_bouncing_parens ();
 static void
 init_bouncing_parens ()
 {
-  if (strncmp (rl_get_keymap_name (rl_get_keymap ()), "vi", 2))
-    {
-      rl_bind_key (')', match_paren);
-      rl_bind_key (']', match_paren);
-      rl_bind_key ('}', match_paren);
-    }
+  Keymap km = rl_get_keymap ();
+  if (km)
+    if (strncmp (rl_get_keymap_name (km), "vi", 2))
+      {
+        rl_bind_key (')', match_paren);
+        rl_bind_key (']', match_paren);
+        rl_bind_key ('}', match_paren);
+      }
+  else
+    scm_error (scm_misc_error_key, "", "readline has not been properly 
initialized",
+               SCM_EOL, SCM_EOL);
 }
 
 static int



reply via email to

[Prev in Thread] Current Thread [Next in Thread]