summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2021-08-23 18:01:28 +0100
committerDaniel Golle <daniel@makrotopia.org>2021-08-24 18:31:46 +0100
commit6010bd3e126717ef8e16a83d5b489aea42de889d (patch)
treeb437f81c434e3f3f7fb5904acab185625da573d8 /utils
parentaf048a34bc68f85427a230e3a2b4c196738e03f8 (diff)
downloadprocd-6010bd3e126717ef8e16a83d5b489aea42de889d.tar.gz
utils: make sure read() string is 0 terminated
Coverity CID: 1490062 String not null terminated Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'utils')
-rw-r--r--utils/utils.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/utils/utils.c b/utils/utils.c
index e90feec..2cfcc8e 100644
--- 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);