diff options
| author | Daniel Golle | 2021-08-23 17:01:28 +0000 |
|---|---|---|
| committer | Daniel Golle | 2021-08-24 17:31:46 +0000 |
| commit | 6010bd3e126717ef8e16a83d5b489aea42de889d (patch) | |
| tree | b437f81c434e3f3f7fb5904acab185625da573d8 | |
| parent | af048a34bc68f85427a230e3a2b4c196738e03f8 (diff) | |
| download | procd-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>
| -rw-r--r-- | utils/utils.c | 1 |
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); |