Skip to content

Commit 73fa7ab

Browse files
Use constant-sized read and document Flawfinder bound
1 parent 716d8f3 commit 73fa7ab

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/OSDHistory.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,9 @@ int LoadHistoryFile(int port)
129129
fd = open(fullpath, O_RDONLY);
130130
result = 0;
131131
if (fd >= 0) {
132-
ssize_t r = read(fd, HistoryEntries, sizeof(HistoryEntries));
133-
if (r < 0 || (size_t)r != sizeof(HistoryEntries))
132+
/* Flawfinder: ignore (bounded read into fixed-size HistoryEntries buffer) */
133+
ssize_t r = read(fd, HistoryEntries, HISTORY_SIZE);
134+
if (r != (ssize_t)HISTORY_SIZE)
134135
result = -EIO;
135136

136137
close(fd);

0 commit comments

Comments
 (0)