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@xxxxxxxxx> --- lib/chip-info.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/chip-info.c b/lib/chip-info.c index 87fd9e7..478cd62 100644 --- a/lib/chip-info.c +++ b/lib/chip-info.c @@ -10,8 +10,8 @@ struct gpiod_chip_info { size_t num_lines; - char name[32]; - char label[32]; + char name[GPIO_MAX_NAME_SIZE+1]; + char label[GPIO_MAX_NAME_SIZE+1]; }; GPIOD_API void gpiod_chip_info_free(struct gpiod_chip_info *info) -- 2.45.2