1
0
mirror of https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git synced 2026-10-24 00:48:53 +03:00

core: fix line-info strings termination

strncpy() truncates the destination buffer if it isn't large enough to
hold the copy. Thus, let's increase the size of the destination strings
to add the NULL character at the end.

Signed-off-by: Iker Pedrosa <ikerpedrosam@gmail.com>
Link: https://lore.kernel.org/r/84db7bbe2c84b2d880052a05f8b1cc123d60c2dc.1722250385.git.ikerpedrosam@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
Iker Pedrosa
2024-07-29 12:57:17 +02:00
committed by Bartosz Golaszewski
parent c497e29ca1
commit 5533f277aa

View File

@@ -10,9 +10,9 @@
struct gpiod_line_info {
unsigned int offset;
char name[GPIO_MAX_NAME_SIZE];
char name[GPIO_MAX_NAME_SIZE+1];
bool used;
char consumer[GPIO_MAX_NAME_SIZE];
char consumer[GPIO_MAX_NAME_SIZE+1];
enum gpiod_line_direction direction;
bool active_low;
enum gpiod_line_bias bias;