27 lines
638 B
Diff
27 lines
638 B
Diff
|
|
From f3196135c106ea0a61af7326cfa383df2f023410 Mon Sep 17 00:00:00 2001
|
||
|
|
From: Mark Nudelman <markn@greenwoodsoftware.com>
|
||
|
|
Date: Sat, 2 Jan 2021 16:43:21 -0800
|
||
|
|
Subject: [PATCH] Protect from buffer overrun.
|
||
|
|
---
|
||
|
|
decode.c | 4 ++--
|
||
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/decode.c b/decode.c
|
||
|
|
index eb0c639..de8d620 100644
|
||
|
|
--- a/decode.c
|
||
|
|
+++ b/decode.c
|
||
|
|
@@ -941,8 +941,8 @@ editchar(c, flags)
|
||
|
|
usercmd[nch+1] = '\0';
|
||
|
|
nch++;
|
||
|
|
action = ecmd_decode(usercmd, &s);
|
||
|
|
- } while (action == A_PREFIX);
|
||
|
|
-
|
||
|
|
+ } while (action == A_PREFIX && nch < MAX_CMDLEN);
|
||
|
|
+
|
||
|
|
if (flags & EC_NORIGHTLEFT)
|
||
|
|
{
|
||
|
|
switch (action)
|
||
|
|
--
|
||
|
|
1.8.3.1
|
||
|
|
|