mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-29 05:39:24 +01:00
display: use l_strlcpy to avoid potential overflow
If 'entry' exceeds the length of 'line' we could overflow. Instead use l_strlcpy and pass in the remaining amount of data left in the buffer.
This commit is contained in:
parent
8139b6bad7
commit
3f1cd5a596
@ -419,7 +419,7 @@ static void display_completion_matches(char **matches, int num_matches,
|
|||||||
}
|
}
|
||||||
|
|
||||||
entry = l_strdup_printf("%-*s ", max_length, matches[index]);
|
entry = l_strdup_printf("%-*s ", max_length, matches[index]);
|
||||||
strcpy(&line[line_used], entry);
|
l_strlcpy(&line[line_used], entry, sizeof(line) - line_used);
|
||||||
l_free(entry);
|
l_free(entry);
|
||||||
|
|
||||||
line_used += max_length + 1;
|
line_used += max_length + 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user