Skip to content
This repository was archived by the owner on Aug 7, 2025. It is now read-only.

Commit 3a73ca4

Browse files
committed
Insure body is null terminated
Signed-off-by: Alex Jaramillo <[email protected]>
1 parent b506773 commit 3a73ca4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/iorecord.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ bool read_record(char *fullpath, char *headers[], char **body, char **cfg_file)
124124
}
125125
memset(*body, 0, (size_t)size);
126126

127-
//read rest of file
128-
size_t newlen = fread(*body, sizeof(char), (size_t)size, fp);
127+
//read rest of file. '-1' ensures it's null terminated
128+
size_t newlen = fread(*body, sizeof(char), (size_t)size - 1, fp);
129129
if (newlen == 0) {
130130
telem_perror("Error reading staged file");
131131
result = false;

0 commit comments

Comments
 (0)