mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-29 05:39:24 +01:00
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>
This commit is contained in:
parent
2f4c09def0
commit
8d2e35b2d4
@ -633,7 +633,7 @@ static void display_completion_matches(char **matches, int num_matches,
|
|||||||
l_free(prompt);
|
l_free(prompt);
|
||||||
|
|
||||||
for (index = 1, line_used = 0; matches[index]; index++) {
|
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");
|
strcpy(&line[line_used], "\n");
|
||||||
|
|
||||||
display_text(line);
|
display_text(line);
|
||||||
|
Loading…
Reference in New Issue
Block a user