From: Iker Pedrosa Date: Mon, 29 Jul 2024 10:57:18 +0000 (+0200) Subject: core: fix chip-info strings termination X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=d71f5ad24663624a17d335462908ae5a8f69bcf7;p=qemu-gpiodev%2Flibgpiod.git core: fix chip-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 Link: https://lore.kernel.org/r/1d7cf79edf75ef77baa56091852be90e2359e572.1722250385.git.ikerpedrosam@gmail.com Signed-off-by: Bartosz Golaszewski --- 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)