aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFinn Behrens <me@kloenk.de>2023-11-10 11:15:58 +0100
committerDenis Kenzior <denkenz@gmail.com>2023-11-11 10:24:01 -0600
commit8d2e35b2d46fd9bfd23e7c3036d2bd116d2bb64a (patch)
treef100deb28e5d2a115d7b1222d0dac2f988c144fd
parent2f4c09def051076c1077a40ac4b34bf38f6e2d54 (diff)
client: display_completion_matches add 0-byte check
Check that enough space for newline and 0-byte is left in line. This fixes a buffer overflow on specific completion results. Reported-By: Leona Maroni <dev@leona.is>
-rw-r--r--client/display.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/client/display.c b/client/display.c
index 8b06ff583..641259348 100644
--- a/client/display.c
+++ b/client/display.c
@@ -633,7 +633,7 @@ static void display_completion_matches(char **matches, int num_matches,
l_free(prompt);
for (index = 1, line_used = 0; matches[index]; index++) {
- if ((line_used + max_length) > LINE_LEN) {
+ if ((line_used + max_length + 1) >= (LINE_LEN - 1)) {
strcpy(&line[line_used], "\n");
display_text(line);