projects
/
qemu-gpiodev
/
libgpiod.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c497e29
)
core: fix line-info strings termination
author
Iker Pedrosa
<ikerpedrosam@gmail.com>
Mon, 29 Jul 2024 10:57:17 +0000
(12:57 +0200)
committer
Bartosz Golaszewski
<bartosz.golaszewski@linaro.org>
Wed, 31 Jul 2024 08:57:39 +0000
(10:57 +0200)
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>
lib/line-info.c
patch
|
blob
|
history
diff --git
a/lib/line-info.c
b/lib/line-info.c
index 9f53b04e804afd618ee91d69434b255c4acc5f3a..a7c6241231478dd51c7365fe3eea69059bd0c664 100644
(file)
--- a/
lib/line-info.c
+++ b/
lib/line-info.c
@@
-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;