diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 07:45:52 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 07:45:52 +0000 |
commit | cbe4cdc48486fbedede448aa59aa6a367efa1038 (patch) | |
tree | 6fc30a23fe7642fd93c5c6c702c4bc8ed5640b38 /lib/common/io.c | |
parent | Adding debian version 2.1.6-5. (diff) | |
download | pacemaker-cbe4cdc48486fbedede448aa59aa6a367efa1038.tar.xz pacemaker-cbe4cdc48486fbedede448aa59aa6a367efa1038.zip |
Merging upstream version 2.1.7.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/common/io.c')
-rw-r--r-- | lib/common/io.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/common/io.c b/lib/common/io.c index 2264e16..35efbe9 100644 --- a/lib/common/io.c +++ b/lib/common/io.c @@ -460,11 +460,17 @@ pcmk__file_contents(const char *filename, char **contents) goto bail; } rewind(fp); - read_len = fread(*contents, 1, length, fp); /* Coverity: False positive */ + + read_len = fread(*contents, 1, length, fp); if (read_len != length) { free(*contents); *contents = NULL; rc = EIO; + } else { + /* Coverity thinks *contents isn't null-terminated. It doesn't + * understand calloc(). + */ + (*contents)[length] = '\0'; } } |