---
 usr.bin/mg/extend.c | 4 ++++
 usr.bin/mg/mg.1     | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/usr.bin/mg/extend.c b/usr.bin/mg/extend.c
index 0898da96798..5d342d102fd 100644
--- a/usr.bin/mg/extend.c
+++ b/usr.bin/mg/extend.c
@@ -771,6 +771,10 @@ excline(char *line)
                        } else
                                key.k_count = 0;
                        while (*argp != '"' && *argp != '\0') {
+                               if (key.k_count >= MAXKEY) {
+                                       status = FALSE;
+                                       goto cleanup;
+                               }
                                if (*argp != '\\')
                                        c = *argp++;
                                else {
diff --git a/usr.bin/mg/mg.1 b/usr.bin/mg/mg.1
index 22604c14778..07a0bcab1d0 100644
--- a/usr.bin/mg/mg.1
+++ b/usr.bin/mg/mg.1
@@ -340,6 +340,8 @@ commands, see
 .Sx MG COMMANDS .
 To see the active keybindings at any time, type
 .Dq M-x describe-bindings .
+.Pp
+Note: there is a maximum of 8 keys per sequence.
 .Sh MG COMMANDS
 Commands are invoked by
 .Dq M-x ,
-- 
2.23.0

Reply via email to