[PATCH libgpiod v2 3/4] lib: chip-info strings termination

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux