projects
/
project
/
procd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
af048a3
)
utils: make sure read() string is 0 terminated
author
Daniel Golle
<daniel@makrotopia.org>
Mon, 23 Aug 2021 17:01:28 +0000
(18:01 +0100)
committer
Daniel Golle
<daniel@makrotopia.org>
Tue, 24 Aug 2021 17:31:46 +0000
(18:31 +0100)
Coverity CID:
1490062
String not null terminated
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
utils/utils.c
patch
|
blob
|
history
diff --git
a/utils/utils.c
b/utils/utils.c
index e90feecb47f3e555ed67cf79ff907561039d00d7..2cfcc8e10c6c930de9aa02c6d77dad2cb2bcd970 100644
(file)
--- a/
utils/utils.c
+++ b/
utils/utils.c
@@
-140,6
+140,7
@@
char *get_active_console(char *out, int len)
char line[CMDLINE_SIZE + 1];
int fd = open("/sys/class/tty/console/active", O_RDONLY);
ssize_t r = read(fd, line, sizeof(line) - 1);
+ line[CMDLINE_SIZE] = '\0';
close(fd);